TIP: Click on subject to list as thread! ANSI
echo: aust_c_here
to: Paul Edwards
from: Adam Fitzpatrick
date: 1996-06-19 03:53:36
subject: indirection

Quoting Paul Edwards to Adam Fitzpatrick:



PE>I am not sure anyone knows everything about C.  I didn't know the

PE>above.  Another thing I only found out recently is that you have

PE>to go unsigned int xxx:1;

PE>in a structure, rather than unsigned short xxx:1;

 

AF>Is that in the standard or something you've observed? This compiled without

AF>error with EMX/GCC:



PE>Actually, it was a warning/error I got from Borland C++ 3.1.

PE>I didn't double-check that in the standard.

 

AF>int main()

AF>{

AF>  struct fred {

AF>    unsigned short xxx:1;

AF>    unsigned int yyy:1;

AF>    unsigned short int zzz:1;

AF>  };

AF>}

 

AF>It might be the compiler (or maybe GCC does something it shouldn't.



PE>Well, if they create an extension, and don't warn you when you use

PE>the extension, it's still just as much the programmer's fault.



Sorry, I was trying to say that I'm not sure what the standard is, and

explaining that it was just what that compiler did, so I wouldn't get 50

messages saying "my compiler doesn't do that".

 

AF>Does "unsigned short int" work?



PE>"short" and "short int" are identical, so I
didn't test that.



I probably didn't explain that well. Because I don't have any standards

lying around here, I wasn't sure if it should allow unsigned short. I was

trying to see whether it was a compiler bug - if "unsigned short" was

rejected but "unsigned short int" worked, you'd know it was the compiler;

I knew they're the same and was relying on it to understand the compiler's

behaviour.



... Kamikaze Tutor: "Watch this, I will do it only once."

--- FMailX 1.02
* Origin: Power BBS - +61-2-858-4114 - Files/Games/EchoMail/Internet (3:711/953)
SEEN-BY: 50/99 620/243 623/630 711/401 409 410 413 430 808 809 932 934 946
SEEN-BY: 711/953 963 712/515 713/888 714/906 800/1
@PATH: 711/953 410 808 934

SOURCE: echomail via fidonet.ozzmosis.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.