Re: walking through an array of char pointers
From: Joe Wright (joewwright_at_comcast.net)
Date: 08/23/04
- Next message: Gordon Burditt: "Re: How to take in a string of any size?"
- Previous message: Fredrik Tolf: "Re: Problem with asm"
- In reply to: pete: "Re: walking through an array of char pointers"
- Next in thread: pete: "Re: walking through an array of char pointers"
- Reply: pete: "Re: walking through an array of char pointers"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Sun, 22 Aug 2004 22:52:17 -0400
pete wrote:
> Joe Wright wrote:
>
>>pete wrote:
>
>
>>> for (np = names; *np != NULL; ++np) {
>>> puts(*np);
>>> }
>
>
>>Ok, printf is too complicated but for is too.
>
>
>> char **np = names;
>> while (*np) puts(*np++);
>
>
> As points of style,
> I prefer to compare pointers against NULL explicitly,
> I always use compound statements with loops, ifs and elses,
> and I prefer not to have side effects in function arguments.
A chacun son gout.
I seriously prefer 'if (p)' over 'if (p != NULL)'.
By 'compound statememts' I suppose you mean curly braces. The use of
curly braces to encompass one statement annoys me.
Expressing 'foo(a++)' is well defined. That a is incremented is not
a side effect. It is an explicit part of the language.
I hope this disagreement doesn't mean we can't play anymore. :=)
--
Joe Wright mailto:joewwright@comcast.net
"Everything should be made as simple as possible, but not simpler."
--- Albert Einstein ---
- Next message: Gordon Burditt: "Re: How to take in a string of any size?"
- Previous message: Fredrik Tolf: "Re: Problem with asm"
- In reply to: pete: "Re: walking through an array of char pointers"
- Next in thread: pete: "Re: walking through an array of char pointers"
- Reply: pete: "Re: walking through an array of char pointers"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]