[Newbies] Reading and writing C structs

David Finlayson dfinlayson at usgs.gov
Sat May 24 05:33:32 UTC 2008


On Fri, May 23, 2008 at 6:17 PM, David T. Lewis <lewis at mail.msen.com> wrote:
>
> Look at the Number class hierarchy (browse hierarchy) and look at the
> "instance creation" category on the class side of each of these classes.
> That will give you some good tips. If you are dealing with simple data
> structures on a single machine architecture, this will not be too
> difficult.

I'll give it a look.

> The binary image of C data structures is inherently non-portable. The
> compiler may pad data to different positions, the byte ordering may
> vary on different hardware, and even simple data types can have different
> sizes and byte orderings from one operating system to another. If you
> are dealing with floating point data types, it's even trickier.
>

Yep, I know. And Smalltalk has reputation for not playing well with
others so there may be some friction here.

> I don't know what instrument you are dealing with, but if there is
> a way to get it to produce data in a more platform-independent manner,
> that may save you some aggrivation in the long run.
>

I work with off-the-shelf sonar systems and lots of ancillary
equipment such as sound velocimeters, RTK GPS, etc. I develop new
post-processing procedures, filters, visualization etc. and usually
code them up as Unix CLI programs in C. I don't have much control over
the design of the systems or the file formats they use. I've noticed
with multi-core machines that the real bottleneck now is I/O not CPU
time. So I thought, why not try a higher-level language than C and
boost my productivity? I am a scientist not a proffesional programmer,
but I've been coding all my life and coding is part of my job. That's
why I am looking into Smalltalk. Can't get much higher level than
this. Besides, I've always wanted to learn Smalltalk and/or Lisp.


More information about the Beginners mailing list