c programming style
Vicious Oyster
oyster at uwmacc.UUCP
Wed Jul 17 02:47:00 AEST 1985
In article <935 at teddy.UUCP> rdp at teddy.UUCP (Richard D. Pierce) writes:
>
>One of the points with the C i++ versus i = i = 1 issue is the one of
>pointers (although some alluded to it).
>
>
>stepping through the array of pointers can be done by by incrementing
>a pointer:
>
> while (condition) /* or some other loop construct */
> . . .
>
> argv++;
>
>This will get us to the next pointer, whereas,
>
> argv = argv + 1;
>
>will NOT (unless by the happy happinstance that a pointer is exactly
>the same size as a character!)
>
>The only equivalent "clear" statement would be:
>
> argv = argv + sizeof(char *); !
>
I worked for a company which was (well, *is*, but going down fast) fond of
making everything proprietary (i.e. non-standard). They came up with a
language called DASL (*), based very strongly on C, which
actually perverted the meaning of arithmetic in such a way that
"argv = argv + n" ACTUALLY MEANT "argv = argv + n*sizeof(argv *)" !! That
wasn't documented anywhere, and we had one hell of a time with a certain
piece of code until we figured out what was going on.
For the record, I think the "++var" idiom is vastly preferable to making up
yet another idiom.
* DASL is a registered to Datapoint Corporation to denote their proprietary
programming language. And if I never see another DASL program in my life
I'll die happy.
--
- joel "vo" plutchak
{allegra,ihnp4,seismo}!uwvax!uwmacc!oyster
"Take what I say in a different way and it's easy to say that this is
all confusion."
More information about the Comp.lang.c
mailing list