home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!spool.mu.edu!olivea!charnel!sifon!thunder.mcrcim.mcgill.edu!mouse
- From: mouse@thunder.mcrcim.mcgill.edu (der Mouse)
- Newsgroups: comp.lang.c
- Subject: Re: Question to test general C knowledge
- Message-ID: <1992Dec21.170917.17770@thunder.mcrcim.mcgill.edu>
- Date: 21 Dec 92 17:09:17 GMT
- References: <1992Dec12.111409.147@ondec.lonestar.org> <mcdonald.622@aries.scs.uiuc.edu>
- Organization: McGill Research Centre for Intelligent Machines
- Lines: 25
-
- In article <mcdonald.622@aries.scs.uiuc.edu>, mcdonald@aries.scs.uiuc.edu (J. D. McDonald) writes:
- > In article <1992Dec18.182206.29158@mksol.dseg.ti.com> mccall@mksol.dseg.ti.com (fred j mccall 575-3539) writes:
-
- >>> 4["this is a test"]
- >> We all know what the type and value is (well it's if type char and
- >> has value ' ' for those who don't know)
-
- > Well, it has value ' '.
-
- > But is it type char??
-
- Yes.
-
- > If it is an expression, it **can't** have type char, because any
- > expression promotes type char to type int.
-
- If it is used in an rvalue context, yes, it gets promoted to int
- immediately. But there are a few contexts where this doesn't happen,
- such as when it's an operand of sizeof. sizeof(4["this is a test"])
- must produce 1, or your compiler's broken.
-
- der Mouse
-
- mouse@larry.mcrcim.mcgill.edu
-