Wireshark mailing list archives

Re: size_t vs int


From: Guy Harris <guy () alum mit edu>
Date: Fri, 4 Sep 2015 10:22:36 -0700


On Sep 4, 2015, at 6:46 AM, Dario Lombardo <dario.lombardo.ml () gmail com> wrote:

The first possibility is to change the "lowest" function, to keep the current prototype but with some integer checks 
and casts.

The second possibility is to "sanitize" the lowest function (in the example above, AFAIK, there is no reason to have 
int as input/output, better have size_t), but this, like a domino effect, requires to change the calling function (in 
the example, change the codec_decode_fn typedef) that propagates the change to other functions and so on. 

The first has less impact, but is more dirty. The second has great impact, but is more correct/elegant.

What do you think?

I vote for the second change.  Object sizes in C code should be represented as size_t.

___________________________________________________________________________
Sent via:    Wireshark-dev mailing list <wireshark-dev () wireshark org>
Archives:    https://www.wireshark.org/lists/wireshark-dev
Unsubscribe: https://wireshark.org/mailman/options/wireshark-dev
             mailto:wireshark-dev-request () wireshark org?subject=unsubscribe


Current thread: