[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Portability of Lua
- From: Roberto Ierusalimschy <roberto@...>
- Date: Wed, 1 May 2013 10:36:12 -0300
> You know it's a lost cause when you see code with `sizeof (char)', although
> at least the developer gets props for trying.
I strongly desagree with this view. I frequently use 'sizeof(char)',
although I am very aware that this is 1 by definition. I think it helps
both to document that you are computing sizes of things with chars (e.g.,
strings) and to change char to some other type (e.g., wchar_t) if the
need comes.
It is a similar point of using '\0' instead of 0; it documents what you
are doing.
-- Roberto