openssl lends itself to simple, elegant c++ wrappers... it is "object
oriented" in design.

it's easy enough to write some simple wrapper classes "SSLCtx", "SSLSock",
etc. that encapsulate some basic functionality and add little or no
overhead - depending on the compiler

the overhead here should be zero - and your code should be easy/clean -
unless you are using a bunch of goofy C++ features (like streams and
templates)

you can even go so far as to derive "SSLSock", "TCPSock", "ProxySock", etc.
from a "Sock" generic socket class so they can be used in socket-independent
code.  the overhead is greater (a virtual deref per Read/Write and some size
increase), but this improved further code reuse anbd readability.

the rule of thumb we use is that if you are reusing your classes and saving
"if/flags" in at least 3 different places in your code - then they are ok.
if you are using classes "just for the sake of using classes" then you
shouldn't use them

etc. etc.



----- Original Message -----
From: Rene G. Eberhard <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Sunday, December 26, 1999 4:09 PM
Subject: RE: c verses c++


> > First off.  Since OpenSSL is written in C and not C++, you can
> > link it easily into a web server regardless of whether the server is
> > written in C or C++.  This means language is not really an issue.
> >  On the other hand if OpenSSL were written in C++, then people
> > like me would have to change the language extention to .cpp
> > rather than .c when we run it through the GNU gcc compiler on
> > systems such as linux and this will increase the code by about
> > 50K (I tested it).
>
> You don't have to change the extension to .cpp. You may use
> the "extern C" directive. All Apache modules I made are written
> in C++. I wrote a pattern that regains C++ objects out of a C code.
> It't also easy to use C++ objects in a C code.
>
> > If you are on an NT server - probably it doesn't
> > matter because probably M$ has not bothered to support both C++
> > and the C language subset and the VCC compiler
> > _probably_ spits out the same code regardless.  Now - I am
> > guessing on this because I do not use VCC on NT.  On NT I use
> > Imprise (Borland) Proffessional builder 4.0 and everything I
> > compile on the NT platform for me is C++ regardless.  And at this
> > point I don't really care anyway so I won't be digging into the
> > bowels of Borland's compiler.
>
> The problem is that a C++ .lib compiled with Borland can not
> be used with the MS VC++ compiler and vice versa. I assume the
> same is true for Unix compiles. It is not standardized how
> objects are put into a .lib. You also may have a problem when
> your C++ .lib has to be backward compatible. There you have to
> take care how you build objects that are visible in the API.
> Of course there exist a pattern too =).
>
> > Ok - I'll talk about implementation methods 2 and 3.  Apache uses
> > #2 from what I can tell.
>
> This is true for Unix systems. Apache for NT works with threads.
>
>
> Regards Rene
>
> --
> -----------------------------------------------------------
> Rene G. Eberhard
> Mail  : [EMAIL PROTECTED]
> ______________________________________________________________________
> OpenSSL Project                                 http://www.openssl.org
> Development Mailing List                       [EMAIL PROTECTED]
> Automated List Manager                           [EMAIL PROTECTED]
>
>

______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
Development Mailing List                       [EMAIL PROTECTED]
Automated List Manager                           [EMAIL PROTECTED]

Reply via email to