Wireshark mailing list archives

Re: Idle Thought - Compiling with C++


From: Guy Harris <guy () alum mit edu>
Date: Sat, 9 Feb 2013 10:50:49 -0800


(Subject line changed to match what you presumably intended.)

On Feb 9, 2013, at 6:41 AM, Evan Huus <eapache () gmail com> wrote:
This just occurred to me as I was reading an article on GCC (which has
recently migrated to using a C++ compiler, despite still being mostly
written in C). I haven't given it a great deal of thought yet, but I
figured I'd bring it up and see what general opinion was.

At a first glance, building Wireshark with C++ compilers would give us
two major benefits:

        ...

- Built-in exceptions. This would be additional migration work, but it
would permit us to drop a non-trivial amount of code that we currently
own in order to do our own exceptions.

Note that I'm not suggesting we start writing Wireshark in C++ (that's
an entirely different debate), but that we could compile using C++
compilers, and then potentially sneak in a few C++ constructs where we
used to roll our own.

Presumably by "start writing Wireshark in C++" you mean "rearchitecting Wireshark as a C++ program", as once you've 
snuck in one C++ construct you're writing in C++. :-)

Note that some of Wireshark, i.e. the Qt GUI part, is already written in C++, and at least one third-party Wireshark 
plugin, i.e. the WSGD packet description language plugin:

        http://wsgd.free.fr

is written in C++.

See also

        http://hub.opensolaris.org/bin/view/User+Group+rs-osug/evan-adams

The Old Man and the C
Evan Adams  
Sun Microsystems

Abstract

"You can't teach an old dog new tricks" goes the old proverb. This is a story about a pack of old dogs (C programmers) 
and their odyssey of trying to learn new tricks (C++ programming).

C++ is a large, complex language which can easily be abused, but also includes many features to help programmers more 
quickly write higher quality code. The TeamWare group consciously decided which C++ features to use and, just as 
importantly, which features not to use. We also incrementally adopted those features we chose to use. This resulted in 
a successful C++ experience.
___________________________________________________________________________
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: