bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [bug-gnulib] style question - const char *


From: Bruno Haible
Subject: Re: [bug-gnulib] style question - const char *
Date: Fri, 6 Jan 2006 20:00:31 +0100
User-agent: KMail/1.5

Paul Eggert wrote on 2005-11-18:
> I prefer putting type qualifiers like "const" after the types they
> modify, as that's more consistent.  ...
>
> Not everyone agrees with this style, but I suspect this is often
> because they haven't thought through the consistency issues.

While I know that "char const *" is more consistent, I prefer to use
"const char *", because it's an idiom that most C programmer know and
understand. Like the parsing of natural language, the parsing of a C
program by a human is largely based on idioms, and "const char *"
meaning "string" is such an idiom.

It's the same reason why I use 'bool' (rather than 'unsigned char' or
'_Bool') to denote a boolean value: it's the common idiom for this type,
therefore using that idiom - rather than rolling your own - makes programs
more readable.

Bruno





reply via email to

[Prev in Thread] Current Thread [Next in Thread]