Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C Programming > GCC typeof Quirk

Reply
Thread Tools

GCC typeof Quirk

 
 
Shao Miller
Guest
Posts: n/a
 
      01-25-2013
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.

--
- Shao Miller
--
"Thank you for the kind words; those are the kind of words I like to hear.

Cheerily," -- Richard Harter
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
typeof emulation Arkadiy C++ 0 02-24-2005 09:28 PM
typeof and g++ fabioppp C++ 10 02-24-2005 09:48 AM
Using TypeOf? Leon ASP .Net 7 11-01-2004 11:41 PM
Use of typeof() for member data declaration (in g++) M. Steinbach C++ 1 02-20-2004 10:28 AM
Use of typeof() for member data declaration (g++ bug?) M. Steinbach C++ 0 02-20-2004 08:40 AM



Advertisments