ANNOUNCEMENT: Live Wireshark University & Allegro Packets online APAC Wireshark Training Session
April 17th, 2024 | 14:30-16:00 SGT (UTC+8) | Online

Wireshark-dev: Re: [Wireshark-dev] Style question passing boolean parameters

From: Stephen Fisher <steve@xxxxxxxxxxxxxxxxxx>
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.