A Query

N

Naren

Hello Grp,

Why is this erroneous
if((uint32 ulStart = MInfo.ulGetNewDataStart()) ==
MInfo.ulGetNewVctrTableStart())
//do something

this works
uint32 ulStart;
if((ulStart = MInfo.ulGetNewDataStart()) == MInfo.ulGetNewVctrTableStart())
//do something

Thanks in advance.

Regards,
Naren.
 
S

Sharad Kala

Naren said:
Hello Grp,

Why is this erroneous
if((uint32 ulStart = MInfo.ulGetNewDataStart()) ==
MInfo.ulGetNewVctrTableStart())
//do something

this works
uint32 ulStart;
if((ulStart = MInfo.ulGetNewDataStart()) == MInfo.ulGetNewVctrTableStart())
//do something

This is off-topic in this news-group.
Try out some newsgroup dedicated for your platform.
 
?

=?ISO-8859-1?Q?Le_G=E9ant_Vert?=

Sharad said:
This is off-topic in this news-group.
Try out some newsgroup dedicated for your platform.
off-topic ?? if you don't like the data types or the functions names,
just consider the following which is exactly the same :

not working :

if ((int i = function()) == value)
do something

working :

int i;
if ((i = function()) == value)
do something

the only difference is the variable declaration location... I don't know
exactly what the standard says, so others may have a more accurate
answer than the one I could give :)
 
P

Phlip

Le said:
off-topic ?? if you don't like the data types or the functions names,
just consider the following which is exactly the same :

not working :

if ((int i = function()) == value)
do something

working :

int i;
if ((i = function()) == value)
do something

the only difference is the variable declaration location... I don't know
exactly what the standard says, so others may have a more accurate
answer than the one I could give :)

Sorry. Your post is off topic because you wrote "the" instead of "The" at
the beginning of that paragraph. And we won't get started about the :) on
the end.

But the original poster is advised to report their error message to a
newsgroup that covers Standard C++ (such as this one).

C++ only recently gained the ability to cram a variable declaration inside
an expression, so some compilers might have a problem with it.
 
M

Michael Mellor

Phlip said:
Sorry. Your post is off topic because you wrote "the" instead of "The" at
the beginning of that paragraph. And we won't get started about the :) on
the end.

But the original poster is advised to report their error message to a
newsgroup that covers Standard C++ (such as this one).

C++ only recently gained the ability to cram a variable declaration inside
an expression, so some compilers might have a problem with it.

This is legal:
if ( int i = 1 ) {
}

what the OP is doing:
if ( (int i = 1) ) {
}
is not legal and if it was, what should the scope of 'i' be?

Michael Mellor
 
?

=?ISO-8859-1?Q?Le_G=E9ant_Vert?=

Phlip said:
Sorry. Your post is off topic because you wrote "the" instead of "The" at
the beginning of that paragraph. And we won't get started about the :) on
the end.
LOL
hum... is "lol" considered off-topic too ? ;)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,159
Messages
2,570,888
Members
47,420
Latest member
ZitaVos505

Latest Threads

Top