Huge thanks to our Platinum Members Endace and LiveAction,
and our Silver Member Veeam, for supporting the Wireshark Foundation and project.

Wireshark-dev: Re: [Wireshark-dev] Idle Thought - Compiling with C++

From: Ed Beroset <beroset@xxxxxxxxxxxxxx>
Date: Mon, 11 Feb 2013 18:42:39 -0500
Evan Huus wrote:
On Mon, Feb 11, 2013 at 1:47 PM, Guy Harris <guy@xxxxxxxxxxxx>
wrote:

Note all the lines flagged with "[-Wc++-compat]"; those are for
code that's valid C but not valid C++ and that would have to be
fixed in order to compile with a C++ compiler (unless there's a
"let valid C code that *could* be handled as C++ code through"
option to all C++ compilers we'd be likely to use).

As per Jakub, we have about 7k of those at the moment. The vast
majority appear to be missing casts from void pointers, which are at
least not difficult to fix (especially since I think many are in
generated code).

I looked at some of those from a dissector I wrote, and I'm pretty sure
I can rewrite to avoid most or all of those, and can use the C-style cast such as "r = (guint *)ptr;" which will also work with C compilers, or I could use the C++ style: "r = static_cast<guint *>(ptr);" For those not familiar with the new style casts in C++, here's a quick pointer: http://www.cplusplus.com/doc/tutorial/typecasting/

Given that we haven't made the transition yet, I'm inclined to use the C-style casts for now. Anybody have a differing opinion?

Ed