From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 109fba,baaf5f793d03d420 X-Google-Attributes: gid109fba,public X-Google-Thread: fc89c,97188312486d4578 X-Google-Attributes: gidfc89c,public X-Google-Thread: 1014db,6154de2e240de72a X-Google-Attributes: gid1014db,public X-Google-Thread: 103376,97188312486d4578 X-Google-Attributes: gid103376,public From: ok@goanna.cs.rmit.edu.au (Richard A. O'Keefe) Subject: Re: What's the best language to start with? [was: Re: Should I learn C or Pascal?] Date: 1996/08/29 Message-ID: <503c9q$1cl@goanna.cs.rmit.edu.au>#1/1 X-Deja-AN: 177179748 distribution: inet references: <31FBC584.4188@ivic.qc.ca> <01bb83f5$923391e0$87ee6fce@timpent.airshields.com> <4uah1k$b2o@solutions.solon.com> <01bb853b$ca4c8e00$87ee6fce@timpent.airshields.com> <4udb2o$7io@solutions.solon.com> <01bb8569$9910dca0$87ee6fce@timpent.airshields.com> <4urqam$r9u@goanna.cs.rmit.edu.au> <01bb8b84$200baa80$87ee6fce@timpent.airshields.com> <4vbbf6$g0a@goanna.cs.rmit.edu.au> <01bb8f18$713e0e60$32ee6fce@timhome2> <4vroh3$17f@goanna.cs.rmit.edu.au> <4vt4qs$eb5@news1.mnsinc.com> organization: Comp Sci, RMIT, Melbourne, Australia newsgroups: comp.lang.c,comp.lang.c++,comp.unix.programmer,comp.lang.ada nntp-posting-user: ok Date: 1996-08-29T00:00:00+00:00 List-Id: SYS0.MICRO-NEIL.COM@ (madscientist) writes: >I Just wanted to point out that this rediculous conversation has taken >reality right out the window! >if(strlen(s)==0) >is *NOT* functionally equivelent to >if(s=="") No, the conversation has *not* taken reality right out the window. I said that 'if (strlen(s) == 0)' is better than 'if (s == "")' precisely BECAUSE both of them are syntactically legal C, but the first one is right and the second one is wrong. THAT WAS THE FLIPPING *POINT*. >If a null string >were allocated with strdup("") then it's address would be somewhere else >entirely and the expression would fail. (a) You have nicely illustrated my point about English being more urgent than assembler. (b) There is no strdup("") in ANSI C. (It's in the System V ABI.) (c) ANSI C has null characters, null pointers, null preprocessing directives, null statements, and "strings with zero length". 'Null string' is an exceptionally confusing phrase to use for empty strings, because it suggests null pointers, which are not empty strings. strdup(""), if strdup() exists, may return a null (string) pointer, or a pointer to an empty string. -- Australian citizen since 14 August 1996. *Now* I can vote the xxxs out! Richard A. O'Keefe; http://www.cs.rmit.edu.au/%7Eok; RMIT Comp.Sci.