home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.c
- Path: sparky!uunet!stanford.edu!nntp.Stanford.EDU!dkeisen
- From: dkeisen@leland.Stanford.EDU (Dave Eisen)
- Subject: Re: Question to test general C knowledge
- Message-ID: <1992Dec18.162732.15771@leland.Stanford.EDU>
- Sender: news@leland.Stanford.EDU (USENET News System)
- Organization: Sequoia Peripherals, Inc.
- References: <1992Dec12.111409.147@ondec.lonestar.org> <1992Dec16.231449.22903@cs.uow.edu.au> <1992Dec18.135841.14009@crd.ge.com>
- Date: Fri, 18 Dec 92 16:27:32 GMT
- Lines: 28
-
- In article <1992Dec18.135841.14009@crd.ge.com> volpe@ausable.crd.ge.com writes:
- >
- >Actually, I prefer the more obfuscated form:
- > 4["this is a test"]
- >
- >And ask them what the type and value is, and WHY this expression is legal.
-
- We all know what the type and value is (well it's if type char and
- has value ' ' for those who don't know), but why it is legal is
- a philosphical question more than anything else. The best answer
- I can think of is "because dmr fucked up." Yes, x[y] is always
- *(x + y) so it can make sense if x is a pointer an y is integral *or*
- vice versa, but why do this?
-
- I can't think of a legitimate reason why you'd want to use x[y] where
- x is an integer and y a pointer. And a compiler is certainly capable
- of checking types before it replaces x[y] with *(x + y). Or is there
- a reason, other than the obvious need for fodder for Obfuscated C
- contests, why this construct should be in the language?
-
-
-
-
- --
- Dave Eisen Sequoia Peripherals: (415) 967-5644
- dkeisen@leland.Stanford.EDU Home: (415) 321-5154
- There's something in my library to offend everybody.
- --- Washington Coalition Against Censorship
-