GCC typeof Quirk

S

Shao Miller

A quick, slightly off-topic note: Although lvalue conversion and array
decay are right next to each other in the Standard, GCC's 'typeof'
keyword seems to treat them differently.

const sometype foo1;
/* bar1 is 'const sometype' */
typeof (foo1) bar1;
/* baz1 is 'const sometype' instead of 'sometype' */
typeof (0, foo1) baz1;

sometype foo2[42];
/* bar2 is 'sometype[42]' */
typeof (foo2) bar2;
/* baz2 is 'sometype *' */
typeof (0, foo2) baz2;

Weird.
 

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

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,584
Members
45,077
Latest member
SangMoor21

Latest Threads

Top