Wireshark mailing list archives
Re: Style question passing boolean parameters
From: Stephen Fisher <steve () stephen-fisher com>
Date: Wed, 20 Jun 2012 09:23:47 -0600
---- On Tue, 19 Jun 2012 23:12:26 -0600 Joerg Mayer wrote ----
What ways are there to fix this? Is replacing the boolean types by an enum with speaking elements a valid solution? As an example, the above might read:
Or using macros, such as: #define NOT_COMPRESSED FALSE
if (cf_save_packets(&cfile, file_name8->str, filetype, NOT_COMPRESSED, DONT_DISCARD_COMMENTS, DONT_REOPEN) != CF_OK) { What would be good names for the elements in the enums?
Can we reuse any of these with other similar functions? If not, I'm inclined to say that they can be specific to each function because they're so useful in improving readability. ___________________________________________________________________________ Sent via: Wireshark-dev mailing list <wireshark-dev () wireshark org> Archives: http://www.wireshark.org/lists/wireshark-dev Unsubscribe: https://wireshark.org/mailman/options/wireshark-dev mailto:wireshark-dev-request () wireshark org?subject=unsubscribe
Current thread:
- Style question passing boolean parameters Joerg Mayer (Jun 19)
- Re: Style question passing boolean parameters Stephen Fisher (Jun 20)
- Re: Style question passing boolean parameters Bill Meier (Jun 20)
- Re: Style question passing boolean parameters Guy Harris (Jun 21)
- Re: Style question passing boolean parameters Guy Harris (Jun 22)