On Mon, 13 Feb 2006, Andrew Morton wrote:
> Roman Zippel <[email protected]> wrote:
>>
>> On Mon, 13 Feb 2006, Andrew Morton wrote:
>>
>> > const arguments to functions are pretty useful for code readability and
>> > maintainability too, if you use them consistently.
>>
>> I could understand that argument, if gcc would warn about it in any way.
>
> It does. If a function tries to modify a formal argument which was marked
> const you'll get a warning.
>
> We're talking about different things here. My point is that it is
> perverted and evil for a function to modify its own args (unless it's very
> small and simple), and a const declaration is a useful way for a
> maintenance programmer to be assured that nobody has done perverted and
> evil things to a function.
> -
This is evil????
void foo(int len)
{
while(len--)
do_something();
}
I don't think so. The function already owns "len". Why should it
create another copy?
Cheers,
Dick Johnson
Penguin : Linux version 2.6.13.4 on an i686 machine (5589.66 BogoMips).
Warning : 98.36% of all statistics are fiction.
_
****************************************************************
The information transmitted in this message is confidential and may be privileged. Any review, retransmission, dissemination, or other use of this information by persons or entities other than the intended recipient is prohibited. If you are not the intended recipient, please notify Analogic Corporation immediately - by replying to this message or by sending an email to [email protected] - and destroy all copies of this information, including any attachments, without reading or disclosing them.
Thank you.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[Index of Archives]
[Kernel Newbies]
[Netfilter]
[Bugtraq]
[Photo]
[Stuff]
[Gimp]
[Yosemite News]
[MIPS Linux]
[ARM Linux]
[Linux Security]
[Linux RAID]
[Video 4 Linux]
[Linux for the blind]
[Linux Resources]