Wireshark mailing list archives

Removing string constants from assertions


From: Evan Huus <eapache () gmail com>
Date: Tue, 4 Sep 2012 16:39:43 -0400

Hi all,

I've noticed in several places the pattern of adding a message to
assertions in the form of a string constant:

g_assert(condition && "explanation");

This seems dangerous to me, primarily because if anyone ever mistypes
the && as a || then the assertion becomes dead code - it will always
pass. Also (though less important):
- it doesn't really add any benefit over simply putting the message in
a comment - a developer will have to open up the code anyways to
figure out what the problem is
- it bloats the size of the binary with a couple of unnecessary string constants

Barring any objections I will convert all such assertion messages to
regular comments.

Cheers,
Evan
___________________________________________________________________________
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: