Wireshark mailing list archives
Re: Idle Thought - Compiling with C++
From: Ed Beroset <beroset () mindspring com>
Date: Sun, 10 Feb 2013 09:06:58 -0500
Donald White wrote:
That said, I have some experience with C to C++ transitions. Twice in my career, the team I was with was given the job of maintaining legacy products written in C (several 100K lines of code) to maintain and enhance. In both cases, our first step was to recompile with a C++ compiler. This was done as a quick and intense effort without introducing any C++ language features. We would just get the code to compile, link and pass its regression tests. Only later did we replace #defines with consts, macros with inline functions and such. I judged these efforts as being very beneficial in improving code quality.
This is a reasonable approach for improving code quality. In an open source project like Wireshark, I think the challenge would be in specifying which C++ features/constructs would NOT be used. Having extensive experience with both C++ and C, I'd say that some of the most useful features in C++ didn't even exist in 1991 when that "Old dogs, new tricks" article was written. Specifically, I mean templates and the Standard Template Library (STL). That said, however and at the risk of stating the obvious, code written in C++ looks a lot different than C written in C++.
For example, to me, the tvbuff.c and value_string.c files cry out for reimplementation as C++ classes, but to actually do such a reimplementation would very literally be a change to the core of Wireshark. If we were to use a C++ compiler as simply an enhanced C compiler, we'd have to figure out how to prevent submissions from including C++ constructs no "approved" by Wireshark coding guidelines.
Ed ___________________________________________________________________________ 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:
- Idle Though - Compiling with C++ Evan Huus (Feb 09)
- Re: Idle Thought - Compiling with C++ Guy Harris (Feb 09)
- Re: Idle Thought - Compiling with C++ Evan Huus (Feb 09)
- Re: Idle Thought - Compiling with C++ Donald White (Feb 09)
- Re: Idle Thought - Compiling with C++ Ed Beroset (Feb 10)
- Re: Idle Thought - Compiling with C++ Evan Huus (Feb 10)
- Re: Idle Thought - Compiling with C++ Dirk Jagdmann (Feb 11)
- Re: Idle Thought - Compiling with C++ Richard Stearn (Feb 11)
- Re: Idle Thought - Compiling with C++ Evan Huus (Feb 11)
- Re: Idle Thought - Compiling with C++ Jakub Zawadzki (Feb 11)
- Re: Idle Thought - Compiling with C++ Jaap Keuter (Feb 12)
- Re: Idle Thought - Compiling with C++ Gerald Combs (Feb 12)
- Re: Idle Thought - Compiling with C++ Jaap Keuter (Feb 12)
- Re: Idle Thought - Compiling with C++ Evan Huus (Feb 12)
- Re: Idle Thought - Compiling with C++ Evan Huus (Feb 09)
- Re: Idle Thought - Compiling with C++ Evan Huus (Feb 12)
- Re: Idle Thought - Compiling with C++ Guy Harris (Feb 09)