[Gllug] Pointer arithmetic with void *

Nix nix at esperi.demon.co.uk
Sun Aug 18 19:10:03 UTC 2002


On Fri, 16 Aug 2002, Jonathan Harker yowled:
> On Thursday 15 August 2002 18:17, Tethys wrote:
>> If there are any benefits in using
>> it, then I'd like to know. Otherwise, I'll avoid the bloat, and stick
>> with C...
> 
> I'm not sure there would be any great difference in the end in terms of speed 
> or bloat.

If you turn off std::ios_base::sync_with_stdio(), there'll be very
little difference in speed at all (with GCC 3.x). Even with it on
there'll not be a vast amount of difference in Linux in particular,
beacuse the libio library that stdio and iostreams are both based upon
is an abstraction of the C++ iostreams layer, not the C stdio layer.

(It's also entirely too much `clever code'. Yes, it's conceptually
elegant to have the jump table that tells libio what to do in particular
cases have the same structure as a C++ ios_base<> virtual method table,
but it also means libio breaks when the C++ ABI or mangling scheme
changes.

Still, hopefully now the C++ ABI is stable this should cease to be a
problem (hoots of derisory laughter follow).

>           I find iostreams code easier to read/follow, but different 
> strokes... I've come to C++ via Java, whereas you sound like you're a bit of 
> a C fan.

iostreams aren't anything like anything in Java, either; they're a
C++-only thing, like the STL part of the Standard library (alas :( I
might use Java if it had an STL and templates, but without them, no
chance.)

-- 
`Mips are real and bitrate earnest, shifting spam is not our goal;
 silicon to sand returnest, was not spoken of the soul.'
   --- _Eventful History: Version 1.x_, John M. Ford

-- 
Gllug mailing list  -  Gllug at linux.co.uk
http://list.ftech.net/mailman/listinfo/gllug




More information about the GLLUG mailing list