[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Interview



"Philipp Gühring" wrote:
> 
> [...]
> >Even where the compiler can be told to not pad certain structures,
> >that often imposes severe performance penalties - and in any case
> >is simply not possible for some machine architectures.
> 
> That sounds logical. So we have to work every struct element by
> element. But I don´t like that because it produces problems, when I
> change the struct, and it´s a lot of code. Then would be nice to
> automatically generate the load/save Code for the structs.

Yes - it is a pain to have to be so careful to change the file
I/O routines every time the structure changes - but that does
have one benefits.  It gives you the opportunity to write code
that can read old files from a previous version of your program.
That may not be important in every case - but it is one small
consolation.

I suppose one way out of that trap would be to write a program
that reads a simple description of a structure and writes out
a header file for the structure AND generates source code for
a file loader AND a file writer. 

That would allow you to change your structures in
just one place - and get automated code for byte swapping,
etc.  You'd then only edit the master description of the
structure and run this hypothetical tool in your Makefile
whenever the master description changes.

You'd only want to use that mechanism for structures that
would be read/written because it would be hard to do that
for things with inheritance, member functions, structures
inside structures, etc.

-- 
Steve Baker                  http://web2.airmail.net/sjbaker1
sjbaker1@airmail.net (home)  http://www.woodsoup.org/~sbaker
sjbaker@hti.com      (work)