Connecting Tech Pros Worldwide Forums | Help | Site Map

meaning of this code line?

Newbie
 
Join Date: Aug 2007
Posts: 8
#1: Aug 22 '07
What is the meaning of this code line?

Expand|Select|Wrap|Line Numbers
  1.  x += b[i] <? mid;

Especially <?

Thanks

JosAH's Avatar
Expert
 
Join Date: Mar 2007
Posts: 10,611
#2: Aug 22 '07

re: meaning of this code line?


Quote:

Originally Posted by metdos

What is the meaning of this code line?

Expand|Select|Wrap|Line Numbers
  1.  x += b[i] <? mid;

Especially <?

Thanks

You posted your question in the C/C++ forum and overhere that gibberish is just
a syntax error.

kind regards,

Jos
Newbie
 
Join Date: Aug 2007
Posts: 8
#3: Aug 22 '07

re: meaning of this code line?


Quote:

Originally Posted by JosAH

You posted your question in the C/C++ forum and overhere that gibberish is just
a syntax error.

kind regards,

Jos

code line just this

x += b[i] <? mid;
JosAH's Avatar
Expert
 
Join Date: Mar 2007
Posts: 10,611
#4: Aug 22 '07

re: meaning of this code line?


Quote:

Originally Posted by metdos

code line just this

x += b[i] <? mid;

Yup, gibberish as I wrote in my previous reply; no need to ask again.
That non-expression just doesn't make sense in C/C++.

kind regards,

Jos
kreagan's Avatar
Familiar Sight
 
Join Date: Aug 2007
Location: New Hampshire
Posts: 153
#5: Aug 22 '07

re: meaning of this code line?


Quote:

Originally Posted by JosAH

Yup, gibberish as I wrote in my previous reply; no need to ask again.
That non-expression just doesn't make sense in C/C++.

kind regards,

Jos

Agree. I never seen <? ever in C/C++

x += b[i] can be translated to

x = x + b[i];
Newbie
 
Join Date: Aug 2007
Posts: 8
#6: Aug 22 '07

re: meaning of this code line?


Quote:

Originally Posted by JosAH

Yup, gibberish as I wrote in my previous reply; no need to ask again.
That non-expression just doesn't make sense in C/C++.

kind regards,

Jos


Do you think code at this link is wrong?

http://www.topcoder.com/stat?c=probl...2420&cr=272072
ilikepython's Avatar
Expert
 
Join Date: Feb 2007
Posts: 839
#7: Aug 22 '07

re: meaning of this code line?


Quote:

Originally Posted by metdos

Do you think code at this link is wrong?

http://www.topcoder.com/stat?c=problem_solution&rm=151070&rd=5850&pm=2420& cr=272072

Well, I can't acces that page because it wants a password, but if it has that angle bracket and question mark, "<?", I'm pretty sure it's wrong. Maybe it's a comment?
sicarie's Avatar
Moderator
 
Join Date: Nov 2006
Location: USA
Posts: 3,929
#8: Aug 22 '07

re: meaning of this code line?


Quote:

Originally Posted by ilikepython

Well, I can't acces that page because it wants a password, but if it has that angle bracket and question mark, "<?", I'm pretty sure it's wrong. Maybe it's a comment?

Looks like PHP to me, unless someone didn't understand the ternary operator..
Moderator
 
Join Date: Mar 2007
Location: North Bend Washington USA
Posts: 5,375
#9: Aug 22 '07

re: meaning of this code line?


Hasn't anyone read JosAH post #2 and #4 ???
Newbie
 
Join Date: Aug 2007
Posts: 8
#10: Aug 22 '07

re: meaning of this code line?


Quote:

Originally Posted by weaknessforcats

Hasn't anyone read JosAH post #2 and #4 ???

I took my answer from another forum:

//
<? was a (now deprecated) operator that is the same as the min operator.
So, b[i] <? mid is the same as min(b[i], mid).

It was in gcc and the other compilers but not in VS.
//

and I think that prejudges are dangerous.
Reply