On portable C programming (was: libraw1394 struct layouts...)
Ben Scott
dragonhawk at gmail.com
Thu Jan 8 13:34:24 EST 2009
On Thu, Jan 8, 2009 at 12:11 PM, Kevin D. Clark
<kevin_d_clark at comcast.net> wrote:
> Ben Scott writes:
>> On Wed, Jan 7, 2009 at 11:31 PM, <VirginSnow at vfemail.net> wrote:
>>> ... function/method for accessing each structure member ...
>> ... only truly portable way, but it's cumbersome ...
>
> Yeah, it is cumbersome. Sometimes programming is hard.
Sometimes? :)
That comment of mine was mainly an observation that a plurality of
programmers are lazy (can be good or bad) plus ignorant and/or
apathetic (always bad), so cumbersome solutions tend to get not-used.
And certainly, from an engineering standpoint, I'm generally in favor
of less cumbersome solutions when possible. Alas, "the best of all
worlds" is rarely this one.
> The thing is, you don't have to do this work until you run into an
> architecture/compiler that absolutely does not do what you want it to.
> Until then your code is fine.
Sure. To paraphrase Larry Wall, a program is "correct" if it gets
the job done, for whatever definition of "job" and "done" you like.
:)
My problem is that as an IT management weenie, I'm the one who's
always getting burned by programmers who define getting the job done
as "compiler produces an executable, and it ran once on my machine
without crashing". Not every programmer works that way, but it seems
like the plurality do. Such experiences tend to affect one's
attitude.
> If you (not anybody in particular) think that code written in this
> manner isn't right and you'd prefer to use something else,
> stop using Linux or any other real-world OS.
I (me in particular) would prefer to use something else. I'd also
prefer that there was no war or hunger or misunderstanding in the
world. :) As I tried to imply in my previous post, reality is rarely
perfect. :)
> ... ultra-high performance is not the primary goal, it is frequently better to
> stream/pass/store/etc. things as text.
Indeed. It's worth mentioning that many of the Internet protocols
are text-based for that very reason, and they won out over more
"sophisticated" alternatives.
-- Ben
More information about the gnhlug-discuss
mailing list