data type promotion

J

John Smith

Hi all

Will the following stuff passed to foo() be promoted to an unsigned long?

unsigned int ui;

foo(ui << 8);

(I get a compiler warning me something is mismatched in the formal versus
actual arguments, but all types are correct).

Thanks
John
 
A

Alex Fraser

John Smith said:
Hi all

Will the following stuff passed to foo() be promoted to an unsigned long?

unsigned int ui;

foo(ui << 8);

(I get a compiler warning me something is mismatched in the formal versus
actual arguments, but all types are correct).

The expression "ui << 8" will be evaluated yielding an unsigned int result.
What (conceptually) happens next depends on what the compiler knows about
foo(). The best thing would be to post back with a complete (compilable) but
minimal program that gives the warning you mention.

Alex
 
J

John Smith

Alex Fraser said:
The expression "ui << 8" will be evaluated yielding an unsigned int result.
What (conceptually) happens next depends on what the compiler knows about
foo(). The best thing would be to post back with a complete (compilable) but
minimal program that gives the warning you mention.

Alex

I will try and churn one out.

Thanks
John
 

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
473,744
Messages
2,569,483
Members
44,901
Latest member
Noble71S45

Latest Threads

Top