On Mar 4, 2014, at 5:43 AM, François-Xavier Le Bail <fx.leb...@yahoo.com> wrote:

> Is it not better to add const in the propotype ?

In what cases, if any, are parameters that are const (rather than non-const 
parameters that point to a const object) useful?

C is pass-by-value, so it's not as if the caller will see any changes the 
callee makes - i.e., the caller has no reason to care.

So declaring an argument as const amounts to a guarantee that the particular 
variable in question will, throughout the function, have the value that was 
passed in, so that somebody reading the code will know that it's not being 
manipulated throughout the function and doesn't have to, in the case of packet 
dissectors, think "wait, is this the length we were handed, or is it the length 
of the part of the packet that we haven't yet dissected"?
_______________________________________________
tcpdump-workers mailing list
tcpdump-workers@lists.tcpdump.org
https://lists.sandelman.ca/mailman/listinfo/tcpdump-workers

Reply via email to