Jump to content
chuckj

Compiler Rejects Unary Minus On Parened Value

Recommended Posts

This is only a minor issue which is easily worked around.

 

Using latest BoostC download Ver 7.04 on Windows XP SP2.

 

Compiler gives invalid operand on:

 

short sTest;

 

sTest = -(20);

 

sTest = -(20*10);

 

 

In general, it looks the compiler does not like unary minus followed by a paren.

 

 

Thanks,

Chuck

Share this post


Link to post
Share on other sites

This is only a minor issue which is easily worked around.

 

Using latest BoostC download Ver 7.04 on Windows XP SP2.

 

Compiler gives invalid operand on:

 

short sTest;

 

sTest = -(20);

 

sTest = -(20*10);

 

 

In general, it looks the compiler does not like unary minus followed by a paren.

Yes you are right.

The problem only occurs when the expression in the parenthesis does not contain a variable.

 

Work around, preceed '-' with a zero, ie:

sTest = 0-(20*10);

 

Btw: I've added this to our bugs list.

 

Regards

Dave

Share this post


Link to post
Share on other sites

Join the conversation

You are posting as a guest. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...