[Insight-developers] So... What platforms DON'T have stdint? (WAS discussion of 64bit niftilib lossage)

Mathieu Malaterre mathieu.malaterre at gmail.com
Wed Jul 25 04:45:04 EDT 2007


On 7/25/07, Steve M. Robbins <steve at sumost.ca> wrote:
> On Tue, Jul 24, 2007 at 02:22:28PM -0400, Sean McBride wrote:
> > On 7/24/07 1:07 PM, kent williams said:
>
> > >Is it really the case that structure alignment is so undependable that it's
> > >necessary to read and write headers a field at a time?
>
> I believe the answer is: yes, if you want portable code.
>
> > struct alignment is largely up to the compiler.  Most compilers provide
> > #pragmas or other methods of forcing an alignment.  I also recommend reading:
> > <http://en.wikipedia.org/wiki/Data_structure_alignment>
> >
> > Reading one field at a time can be a performance problem, especially if
> > each read generates new disk activity.
>
> True, but you can be smarter about it: read a reasonable-sized
> buffer and parse it a field at a time.

Shouldn't the iostream/fstream stuff already do that ? Or is this an
implementation specific thing ?

Or even a system specific thing: on my linux ReiserFS system, reading
twice the same file (different process) can be totally different in
timing.

-Mathieu


More information about the Insight-developers mailing list