Re: Writing single bits to a file
- From: "Charlie Gordon" <news@xxxxxxxxxxx>
- Date: Sat, 27 Oct 2007 22:58:10 +0200
"Martin Wells" <warint@xxxxxxxxxx> a écrit dans le message de news:
1193515386.951349.284640@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Chqrlie:
And getting rid of these extra const qualifiers on the function
parameters
would improve readability, making parameter name mixup more obvious.
To be honest I'll use const wherever I can, unless it's stupid (and by
stupid I mean makes no difference whatsoever, or that the difference
has no benefits). An example of such a "stupid" case would be casting
to a const type, reason being that it doesn't make a difference
whether an R-value is const or not because you can't modify it anyway.
If I take a pointer as an argument to a function, and if I don't
intend on changing the pointer at all, then it makes sense to me to
declare it as const. Also, I don't find that it detracts form
readibility or that it adds confusion, so I suppose we just have
different opinions on this.
Given your choice of field names, you shouldn't be too proud of your coding
conventions, stylistic or otherwise. We do disagree on what you consider
'stupid' as well. IMHO, if the need arises to cast a qualified pointer to a
different type in an expression, needlessly unqualifying it at the same time
*is* stupid.
const qualifying the parameters of a 3 line function is completely useless.
Just like casting strcpy to (void) and casting the result of malloc().
--
Chqrlie.
.
- Follow-Ups:
- Re: Writing single bits to a file
- From: cr88192
- Re: Writing single bits to a file
- From: Martin Wells
- Re: Writing single bits to a file
- References:
- Writing single bits to a file
- From: riva
- Re: Writing single bits to a file
- From: Martin Wells
- Re: Writing single bits to a file
- From: Charlie Gordon
- Re: Writing single bits to a file
- From: Martin Wells
- Writing single bits to a file
- Prev by Date: Re: Bug/Gross InEfficiency in HeathField's fgetline program
- Next by Date: Re: C pronunciation question
- Previous by thread: Re: Writing single bits to a file
- Next by thread: Re: Writing single bits to a file
- Index(es):
Relevant Pages
|