Slightly OT, but pertinant to ANSI C 
Author Message
 Slightly OT, but pertinant to ANSI C

After surfing this group for a while now, something has struck me as
interesting.  Everybody harps on writing ONLY ANSI C code, or only
posting question in ANSI C, or only praying to the ANSI C standards....

I don't dissagree that standard coding methods are a good thing, I don't
dissagree that you should promote unity in the programming community and
standards are a way to accomplish this..  Now for the question.

How many of you ANSI C programmers have coded ENTIRELY in ANSI C for a
production program.  That is you haven't slipped in any small deviations
because ANSI would have taken too much time, or you couldn't figure out
how to do it in ANSI so you just cooked up some code to finish the
program.

So then who wants to be the first to say they code entirely in ANSI C?
Or how about this, do you all agree that ANSI C is the way you should
code production programs (that require C of course!!) - or is ANSI just
an ideal to shoot for.

Believe it or not I don't want to start a flame war, I'm really more
interested in how strictly production programmers hold themselves to the
ANSI standards.  I'm a system administrator and I browse this group to
glean some programming tips and to keep in touch with the community.  

Thanks for taking the time to answer nicely
Rob

--
All these opinions are mine,
and are not shared by
The Boeing Company.



Tue, 30 Mar 2004 03:15:45 GMT  
 Slightly OT, but pertinant to ANSI C

Quote:

> How many of you ANSI C programmers have coded ENTIRELY in ANSI C for a
> production program.  That is you haven't slipped in any small deviations
> because ANSI would have taken too much time, or you couldn't figure out
> how to do it in ANSI so you just cooked up some code to finish the
> program.

Rob...

Please don't confuse the forum with the arena. The newsgroup can function
only because discussion is limited (at least in theory) to ANSI/ISO C.
Opening it to discussions of platform-specific extensions would drown
discussion of C in noise.

A very direct result of my own participation in c.l.c has been that I make a
serious effort to write strictly ANSI code. When not possible (frequent) I
isolate POSIX calls in separate modules; and when I need to use non-ANSI,
non-POSIX extensions (/very/ seldom) that code is segregated from the
others.

This all struck me as a big PITA in the early stages; but has become
more-or-less natural with use.

I'm not sure if this is the kind of answer you were expecting; but the
approach has made my life (and others') much easier.
--
Morris Dovey
West Des Moines, Iowa USA



Tue, 30 Mar 2004 04:13:21 GMT  
 Slightly OT, but pertinant to ANSI C

    RG> After surfing this group for a while now, something has struck me as
    RG> interesting.  Everybody harps on writing ONLY ANSI C code, or only
    RG> posting question in ANSI C, or only praying to the ANSI C standards....

I don't think anyone uses _only_ ISO code in "real" programs.  The
point that is often made is that this newsgroup only deals with the
ISO portion of people's code.  ISO C is a "lowest common
denominator".  That is, most C compilers support ISO C, as well as
their own extensions.  By using as much ISO C as possible in your
code, you increase portability, as only localized changes must be
made.

The reason we only allow questions regarding ISO C is that it is what
everyone here knows.  If someone asks a question regarding, for
example, Borland C, I can't help.  And if someone posts an answer to a
question regarding Borland C, but it is incorrect, many of the experts
here would be unable to correct the answer.  However, if an incorrect
answer is given regarding an ISO C question, there are several people
here that can correct this.

[...]

    RG> How many of you ANSI C programmers have coded ENTIRELY in ANSI C for a
    RG> production program.  That is you haven't slipped in any small deviations
    RG> because ANSI would have taken too much time, or you couldn't figure out
    RG> how to do it in ANSI so you just cooked up some code to finish the
    RG> program.

I code as much as possible in ISO C.  However, I have never written a
real-world program that is 100% ISO.  On the other hand, if I do write
a program that uses non-ISO extensions, I don't post questions about
it here.  Most of my code is POSIX, and I would ask in
comp.unix.programmer.  What isn't POSIX or ISO is OS-specific, so I
ask in comp.os.qnx.

    RG> So then who wants to be the first to say they code entirely in ANSI C?
    RG> Or how about this, do you all agree that ANSI C is the way you should
    RG> code production programs (that require C of course!!) - or is ANSI just
    RG> an ideal to shoot for.

The core of the program should be ISO C.  Only the edges, where
non-ISO functionality is required, should other coding techniques be used.

[...]

    RG> Thanks for taking the time to answer nicely
    RG> Rob

Hope that was nice enough :)

Cheers,
Kevin

--
He that breaks a thing to find out what it is has left the path of
wisdom                                         -- Gandalf the Grey



Tue, 30 Mar 2004 04:24:43 GMT  
 Slightly OT, but pertinant to ANSI C


Quote:
> After surfing this group for a while now, something has struck me as
> interesting.  Everybody harps on writing ONLY ANSI C code, or only
> posting question in ANSI C, or only praying to the ANSI C standards....

Yes, this is because we discuss about the C-language (hence comp.lang.c).
It happens that this language is word-widely defined by ISO (and ANSI in
USA, AFNOR in France etc.)

Quote:
> I don't dissagree that standard coding methods are a good thing, I don't
> dissagree that you should promote unity in the programming community and
> standards are a way to accomplish this..  Now for the question.

The idea is that ISO code is supposed to be portable, which is exactly the
purpose of the C-language. IMO, breaking this rule is just stupid. (See
Microsoft's nightmare like Win 32 API)

Quote:
> How many of you ANSI C programmers have coded ENTIRELY in ANSI C for a
> production program.  That is you haven't slipped in any small deviations
> because ANSI would have taken too much time, or you couldn't figure out
> how to do it in ANSI so you just cooked up some code to finish the
> program.

The production application code I write (embedded software for 68k) is 95%
ISO. The main advantage is that is is written, unit tested and roughly
integrated on a PC, before being recompiled for 68k and downloaded to the
target. The production library code I write is also 99% to 100% ISO-C.

Of course, hardware components interfaces are target specific. But is is
very easy to abstract them to a simple

iowrite(context,register,data)
data = ioread(context,register)

pair of functions.

Quote:
> So then who wants to be the first to say they code entirely in ANSI C?
> Or how about this, do you all agree that ANSI C is the way you should
> code production programs (that require C of course!!) - or is ANSI just
> an ideal to shoot for.

There are many cases wher an ISO solution can be used, and is in fact
preferable in term of portability.

Quote:
> Believe it or not I don't want to start a flame war, I'm really more

I trust you.

Quote:
> interested in how strictly production programmers hold themselves to the
> ANSI standards.  I'm a system administrator and I browse this group to
> glean some programming tips and to keep in touch with the community.  

It's just a question of good health. Why should I use non-standard stuff?
Why should I stuff my brain with non-portable techniques?

--
-hs- emdel at noos.fr "support Afghans against Taleban"
"Car les bandits qui sont cause des guerres
 N'en meurent jamais, on n'tue qu'les innocents."
Gaston Monthus -- La Butte Rouge



Tue, 30 Mar 2004 04:34:59 GMT  
 Slightly OT, but pertinant to ANSI C

Quote:

>After surfing this group for a while now, something has struck me as
>interesting.  Everybody harps on writing ONLY ANSI C code, or only
>posting question in ANSI C, or only praying to the ANSI C standards....

Not exactly "writing only ANSI (well, ISO) C code, but only _discussing_
standard C in this newsgroup. There is a difference between these two
concepts.

Quote:
>I don't dissagree that standard coding methods are a good thing, I don't
>dissagree that you should promote unity in the programming community and
>standards are a way to accomplish this..  Now for the question.
>How many of you ANSI C programmers have coded ENTIRELY in ANSI C for a
>production program.  That is you haven't slipped in any small deviations
>because ANSI would have taken too much time, or you couldn't figure out
>how to do it in ANSI so you just cooked up some code to finish the
>program.

You assume things that are wrong. Usually, system specific solutions or
extentions are only faster if you have to code for one target platform,
and even then the advantage is quite dubious most of the time. Don't
think in "programs", think in features. Lots of features in a "program"
for actuarial or statistical use can be coded in portable C. To use
that feature on a different platform, transfer the source code, recompile,
and your're done.

Quote:
>So then who wants to be the first to say they code entirely in ANSI C?

I code lots of features in portable C. Some of them depend on a
certain floating point format, but they are at least portable
between a wide range of machines that use that flaoting point
format.

Quote:
>Or how about this, do you all agree that ANSI C is the way you should
>code production programs (that require C of course!!) - or is ANSI just
>an ideal to shoot for.

If you need system specific extentions for a feature, you should isolate
it from the other features, put it in different compilation units, an strife
to keep the core functionality in compilation units that use no
system specific extentions.

And you should not discuss problems with the system specific extentions
in comp.lang.c

Kurt

--
| Kurt Watzka                            



Tue, 30 Mar 2004 04:48:21 GMT  
 Slightly OT, but pertinant to ANSI C

Quote:

> After surfing this group for a while now, something has struck me as
> interesting.  Everybody harps on writing ONLY ANSI C code,

Well, in *this* newsgroup, yes. There are lots of newsgroups dealing
with non-ISO code, and some of the regular contributors to this
newsgroup also contribute to those newsgroups.

Quote:
> or only
> posting question in ANSI C,

Since this newsgroup discusses ISO C, it makes sense to post questions
about ISO C here. If you have questions about non-ISO C issues, there
are plenty of newsgroups around which will meet your needs more than
adequately.

Quote:
> or only praying to the ANSI C standards....

I don't pray to the ANSI Standard. I just use it as a tool so that I can
do my job better.

Quote:
> How many of you ANSI C programmers have coded ENTIRELY in ANSI C for a
> production program.

I have. Quite a few of them, in fact.

Quote:
> That is you haven't slipped in any small deviations
> because ANSI would have taken too much time, or you couldn't figure out
> how to do it in ANSI so you just cooked up some code to finish the
> program.

Modulo my ignorance of the Standard, I generally stick to portable code
unless there is a specific reason not to. For example, yesterday, I
wrote a Windows program whose job was to pretend that it was an
infra-red device, thus fooling a Linux program into allowing itself to
be exercised automatically rather than by a human being pushing buttons
on a remote (making 1000 keypresses at a constant rate of around 2 per
second is not generally considered to be something a human excels at).
And guess what? This program was /not/ written in ISO C!! (In fact, I
used C++ Builder...)

Be portable when you can, non-portable when you must.

Quote:
> So then who wants to be the first to say they code entirely in ANSI C?

I code in ISO C when it's appropriate, and not when it isn't. It's
appropriate far more often than one might think, but by no means all the
time.

Quote:
> Or how about this, do you all agree that ANSI C is the way you should
> code production programs (that require C of course!!) - or is ANSI just
> an ideal to shoot for.

It depends on the requirements and the task. If the task can be done in
ISO C (and many can), then why not do it that way? And if the
requirements say "this will be a GUI program with sound and graphics and
stuff" then there is still scope for portable programming but obviously
there will be some non-portable bits; if it matters (and it might), you
can do something to make a future porting job easier, of course.

Quote:
> Believe it or not I don't want to start a flame war, I'm really more
> interested in how strictly production programmers hold themselves to the
> ANSI standards.

When it is possible, I follow the ISO C Standard as closely as I know
how. When I must write non-portable code, I make a judgement on the
expected lifetime of the program. If it may be around for a while, it
may well get ported, so it makes sense to take extra time to make it
/easy/ to port.

Quote:
> Thanks for taking the time to answer nicely

Any time.  :-)

--

"Usenet is a strange place." - Dennis M Ritchie, 29 July 1999.
C FAQ: http://www.eskimo.com/~scs/C-faq/top.html
K&R answers, C books, etc: http://users.powernet.co.uk/eton



Tue, 30 Mar 2004 04:46:38 GMT  
 Slightly OT, but pertinant to ANSI C

Quote:

> After surfing this group for a while now, something has struck me as
> interesting.  Everybody harps on writing ONLY ANSI C code, or only
> posting question in ANSI C, or only praying to the ANSI C standards....

That last phrase disqualifies you from intelligent discourse.


Tue, 30 Mar 2004 05:13:01 GMT  
 Slightly OT, but pertinant to ANSI C

Quote:

>After surfing this group for a while now, something has struck me as
>interesting.  Everybody harps on writing ONLY ANSI C code, or only
>posting question in ANSI C, or only praying to the ANSI C standards....

>I don't dissagree that standard coding methods are a good thing, I don't

ANSI C is not a coding method, but a language.

Quote:
>dissagree that you should promote unity in the programming community and
>standards are a way to accomplish this..  Now for the question.

Nobody is promoting unity anywhere, only adherence to the topic in
the newsgroup comp.lang.c.

Quote:
>How many of you ANSI C programmers have coded ENTIRELY in ANSI C for a
>production program.

Compilers are production programs that can be written entirely in ANSI C,
as can many other kinds of tools. Of course, the topics of comp.lang.c
are not determined by what can be coded in a production program.

Even if you are working on a program that interfaces with the features
of a platform, it can be useful and important to know which parts are
standard C and which are not, so that you can exercise proper hygiene
in separating these pieces in some way, so that the program is designed
with a plan for retargetting to different platforms.

Quote:
> That is you haven't slipped in any small deviations
>because ANSI would have taken too much time, or you couldn't figure out
>how to do it in ANSI so you just cooked up some code to finish the
>program.

I find that understanding ANSI C saves me time, because I can eradicate
platform-specific reasoning from situations that do not call for it.
The range of portable things you can do with ANSI C is much smaller than
the range of things you can do with a C implementation. Effectively,
ANSI C is a smaller language than any of the platform-specific dialects
which extend it.

By working in a smaller language, you can sometimes end up with larger
code, but all that is needed to understand that code is gathered in
one document, and it doesn't have to be corrected or bloated to support
additional platforms.

But do you really end up with larger code? I find that by understanding
the standard language in detail, I can use its portable subset much
more effectively than some programmer who gropes around in a
platform-specific C dialect with the help of an incomplete compiler
reference manual.

Also, it's worth mentioning another phenomenon you sometimes see:
programmers who don't understand ANSI C sometimes invent poor devices that
are supposed to aid the portability of the program. These devices actually
become counterproductive obstacles to readability and maintainability,
and are often nonportable anyway, or don't address true portability
issues.  The corresponding maximally portable ANSI C code is shorter
and cleaner by comparison.

Quote:
>So then who wants to be the first to say they code entirely in ANSI C?
>Or how about this, do you all agree that ANSI C is the way you should
>code production programs (that require C of course!!) - or is ANSI just
>an ideal to shoot for.

Nobody in their right mind can possibly agree with this. If the production
program needs to do something that isn't in the language, then that
program cannot be written entirely in ANSI C.  Whether or not something
can be written in ANSI C depends on the match between its requirements
and the capabilities of ANSI C.  But if it is a large program, it will
consist of subprograms, in the form of C translation units. Some of these
units can probably be written using only the portable features of ANSI C,
so there is usually no good reason not to do so, other than ignorance.


Tue, 30 Mar 2004 05:19:35 GMT  
 Slightly OT, but pertinant to ANSI C

Quote:

>After surfing this group for a while now, something has struck me as
>interesting.  Everybody harps on writing ONLY ANSI C code, or only
>posting question in ANSI C, or only praying to the ANSI C standards....

>I don't dissagree that standard coding methods are a good thing, I don't

ANSI C is not a coding method, but a language.

Quote:
>dissagree that you should promote unity in the programming community and
>standards are a way to accomplish this..  Now for the question.

Nobody is promoting unity anywhere, only adherence to the topic in
the newsgroup comp.lang.c.

Quote:
>How many of you ANSI C programmers have coded ENTIRELY in ANSI C for a
>production program.

Compilers are production programs that can be written entirely in ANSI C,
as can many other kinds of tools. Of course, the topics of comp.lang.c
are not determined by what can be coded in a production program.

Even if you are working on a program that interfaces with the features
of a platform, it can be useful and important to know which parts are
standard C and which are not, so that you can exercise proper hygiene
in separating these pieces in some way, so that the program is designed
with a plan for retargetting to different platforms.

Quote:
> That is you haven't slipped in any small deviations
>because ANSI would have taken too much time, or you couldn't figure out
>how to do it in ANSI so you just cooked up some code to finish the
>program.

I find that understanding ANSI C saves me time, because I can eradicate
platform-specific reasoning from situations that do not call for it.
The range of portable things you can do with ANSI C is much smaller than
the range of things you can do with a C implementation. Effectively,
ANSI C is a smaller language than any of the platform-specific dialects
which extend it.

By working in a smaller language, you can sometimes end up with larger
code, but all that is needed to understand that code is gathered in
one document, and it doesn't have to be corrected or bloated to support
additional platforms.

But do you really end up with larger code? I find that by understanding
the standard language in detail, I can use its portable subset much
more effectively than some programmer who gropes around in a
platform-specific C dialect with the help of an incomplete compiler
reference manual.

Also, it's worth mentioning another phenomenon you sometimes see:
programmers who don't understand ANSI C sometimes invent poor devices that
are supposed to aid the portability of the program. These devices actually
become counterproductive obstacles to readability and maintainability,
and are often nonportable anyway, or don't address true portability
issues.  The corresponding maximally portable ANSI C code is shorter
and cleaner by comparison.

Quote:
>So then who wants to be the first to say they code entirely in ANSI C?
>Or how about this, do you all agree that ANSI C is the way you should
>code production programs (that require C of course!!) - or is ANSI just
>an ideal to shoot for.

Nobody in their right mind can possibly agree with this. If the production
program needs to do something that isn't in the language, then that
program cannot be written entirely in ANSI C.  Whether or not something
can be written in ANSI C depends on the match between its requirements
and the capabilities of ANSI C.  But if it is a large program, it will
consist of subprograms, in the form of C translation units. Some of these
units can probably be written using only the portable features of ANSI C,
so there is usually no good reason not to do so.


Tue, 30 Mar 2004 05:21:27 GMT  
 Slightly OT, but pertinant to ANSI C

Quote:

> After surfing this group for a while now, something has struck me as
> interesting.  Everybody harps on writing ONLY ANSI C code, or only
> posting question in ANSI C, or only praying to the ANSI C standards....

> I don't dissagree that standard coding methods are a good thing, I don't
> dissagree that you should promote unity in the programming community and
> standards are a way to accomplish this..  Now for the question.

> How many of you ANSI C programmers have coded ENTIRELY in ANSI C for a
> production program.  That is you haven't slipped in any small deviations
> because ANSI would have taken too much time, or you couldn't figure out
> how to do it in ANSI so you just cooked up some code to finish the
> program.

> So then who wants to be the first to say they code entirely in ANSI C?
> Or how about this, do you all agree that ANSI C is the way you should
> code production programs (that require C of course!!) - or is ANSI just
> an ideal to shoot for.

> Believe it or not I don't want to start a flame war, I'm really more
> interested in how strictly production programmers hold themselves to the
> ANSI standards.  I'm a system administrator and I browse this group to
> glean some programming tips and to keep in touch with the community.

    The principal advantage of adhering to a standard -- the C Standard
and/or any others -- is that doing so improves the chances that your
code will be understood in the same way by machines other than the one
you happen to be using at the moment and by programmers other than
yourself.  (The debate over which of these two audiences is the more
important remains unsettled.)  Other lesser advantages also accrue:
for example, you're in a better position vis-a-vis the vendor of a
buggy compiler if the bug affects Standard-conforming code than if it
only occurs when you indulge in dubious or idiosyncratic practices.

    Still, portability and maintainability are not the only attributes
of importance in all circumstances.  They are usually less important
than correctness, for example.  Sometimes (less often than commonly
thought, IMHO) speed is paramount.  Sometimes the overriding criterion
is "Get it done by 3PM."  The craft of programming consists in large
measure of finding the right compromises between divergent goals, and
it is often the case that the compromises appropriate to Project X
would be anathema in Project Y.

    A reasonable approach to writing code when portability is important
(and IMHO it turns out to be important more often than not) is to use
the capabilities of the "weakest" or "broadest" standard at hand for as
long as they will suffice, to graduate to "stronger" or "narrower"
standards as and only as needed, and to resort to unstandardized methods
only in extremis.  This guideline tells me, for example, that most of my
program's code can be in Standard C, except for the parts which handle
the inter-process communication.  At that point I'll have to rely on the
family of Unix standards, but I'll stick to what they provide -- right
up to the point where I simply *must* use the Solaris "doors" interface.
Each time I invoke an additional standard I gain access to additional
capabilities at the cost of making my code more difficult to port.  The
important thing is to be aware of when you're crossing the lines, and
to do so only when there's a good reason.

    I'd like to revisit one of your remarks just a bit:

Quote:
> [...] you haven't slipped in any small deviations
> because ANSI would have taken too much time, or you couldn't figure out
> how to do it in ANSI so you just cooked up some code to finish the
> program.

    One of the purposes of this discussion group is to help people
"figure out how to do it in ANSI" when perhaps they haven't figured
it out for themselves.  This entails educating people about what
guarantees the Standard does and doesn't provide, and teaching them
how to stay within those guarantees as much as possible.  It is quite
often the case that non-conforming code results from ignorance rather
than from necessity.  This week, for example, code to classify letters
as consonants and vowels was debated, and one poster "improved" matters
by offering the expression `ch | 0x20' as a means to fold upper- and
lower-case letters together.  That's ignorance at work: This person was
trying to be helpful, but apparently didn't know why `ch | 0x20' wasn't
portable and didn't know how to use the entirely Standard-conforming
toupper() facility.  Presumably, he now knows both; if so, the group
is fulfilling one of its purposes.

    Finally, to what I think is your main question:

Quote:
> How many of you ANSI C programmers have coded ENTIRELY in ANSI C for a
> production program.

    I have done so on occasion, but many of my programs have relied
on implementation characteristics not guaranteed by the Standard.  I
have been known to write code which assumes that `time_t' is a count
which ticks once per second.  I write `(unsigned long)time(NULL)' and
pass the result to srand().  I sometimes use functions like ftruncate()
or mmap() or accept() or gethrtime().  But I try always to remain
conscious of when I've overstepped a boundary, and to do so with eyes
open and with their sense not shut.

--



Tue, 30 Mar 2004 05:10:08 GMT  
 Slightly OT, but pertinant to ANSI C

Quote:
>The idea is that ISO code is supposed to be portable, which is exactly the
>purpose of the C-language.

No, it isn't.  See the definition of "conforming program" from the ISO C
standard.

If the purpose of the C language was portability, there would be
no implementation-defined, unspecified and undefined aspects of the
language.  Implementations would be forbidden to provide extensions.

If you want Java, you know where to find it :-)

Dan
--
Dan Pop
CERN, IT Division

Mail:  CERN - IT, Bat. 31 1-014, CH-1211 Geneve 23, Switzerland



Tue, 30 Mar 2004 06:11:33 GMT  
 Slightly OT, but pertinant to ANSI C


Quote:
>After surfing this group for a while now, something has struck me as
>interesting.  Everybody harps on writing ONLY ANSI C code, or only
>posting question in ANSI C, or only praying to the ANSI C standards....

(This is supposed to provoke reasoned discourse, rather than flamage?)

This group is for and about ANSI C.  For non-ANSI stuff there are other
groups such as comp.unix.programmer, gnu.gcc.*, and so on.

Quote:
>How many of you ANSI C programmers have coded ENTIRELY in ANSI C for a
>production program.

[from my web page]

  Standards?  We don't need any stinkin' standards!

   Well, actually, maybe you do.  It really is a question of what you
   want to do.

   The standard -- either one -- is not the End of All C.  Writing
   `strictly conforming' C code, however, has an enormous benefit.  The C
   standards are, in essence, a contract between you -- a programmer  
   writing C code -- and the implementor supplying your C compiler and
   library.  This contract says, in effect, that as long as you stick to
   your part of the bargain, the implementor must stick to his.  The
   moment you violate your side of the deal, the implementor is free to
   violate his, too.

   In practice, this means that any strictly conforming code you write
   will work on every C compiler. ... it also means that you can change
   compilers or even machines.  If, after getting halfway through a
   program, your boss comes to you and says `the model Q computer is
   obsolete; we're buying model R machines now' and you wrote Q-specific
   code, you will have to rewrite it all.  If you wrote standard C, it
   will all work on model R.

   Standard C is quite limited.  It has no networking, no graphics, no
   mouse support; it cannot start processes, print to printers, and so
   on.  Nonetheless, it can do a lot -- and if you decompose whatever
   program you are writing into `portable' and `non-portable' sections,  
   you may never have to rewrite the portable parts.  If you need to  
   start a process over the network, put that task in a separate function
   in a separate file.  Supply a different function (and file) for each
   different system as needed.  Your program will still require network
   and process extensions, but now you will only have to rewrite the
   `start network process' function each time you move the program.
--
In-Real-Life: Chris Torek, Wind River Systems (BSD engineering)




Tue, 30 Mar 2004 06:29:43 GMT  
 Slightly OT, but pertinant to ANSI C

Quote:

> Believe it or not I don't want to start a flame war, I'm really more
> interested in how strictly production programmers hold themselves to the
> ANSI standards.  I'm a system administrator and I browse this group to
> glean some programming tips and to keep in touch with the community.

Very strictly, where possible.  What I try to do is factor a program so
that platform- (or worse, compiler-) specific code is put in certain
functions, but the majority of the code is pure ANSI.

That way, porting to new platforms is made simpler, and anyone with ANSI
C knowledge (not necessarily knowledge of the target platforms) can get
a very good idea of the way the program works, very quickly.

--
Duncan Bayne
1974 Yamaha RD350

+---------------------------+---------------------------------------+

+---------------------------+---------------------------------------+
|  Walk For Capitalism:                                             |
|         - http://WalkForCapitalism.org                            |
|                                                                   |
|  New Zealand Cities:                                              |
|          - http://www.walkforcapitalism.org/auckland/index.html   |
|          - http://www.walkforcapitalism.org/wellington/index.html |
+-------------------------------------------------------------------+



Tue, 30 Mar 2004 06:34:05 GMT  
 Slightly OT, but pertinant to ANSI C


Quote:

>> After surfing this group for a while now, something has struck me as
>> interesting.  Everybody harps on writing ONLY ANSI C code, or only
>> posting question in ANSI C, or only praying to the ANSI C standards....

> That last phrase disqualifies you from intelligent discourse.

Oh, come on: that read to me as a rhetorical device (on a par with
referring to style wars as "religious", a term with darkly unfortunate
overtones at the moment).

The *rest* of his post looked sane: I think you missed out.

--
Chris "and he didn't say 'surely'" Dollin
C FAQs at: http://www.faqs.org/faqs/by-newsgroup/comp/comp.lang.c.html



Tue, 30 Mar 2004 15:42:40 GMT  
 Slightly OT, but pertinant to ANSI C
On Thu, 11 Oct 2001 19:15:45 GMT, Robert Gilster said:

Quote:
>After surfing this group for a while now, something has struck me as
>interesting.  Everybody harps on writing ONLY ANSI C code, or only
>posting question in ANSI C, or only praying to the ANSI C standards....

That's what's topical here. If you want to talk about the
application of C other than ANSI C, then you need to find another
group.

Quote:
>How many of you ANSI C programmers have coded ENTIRELY in ANSI C for a
>production program.  That is you haven't slipped in any small deviations
>because ANSI would have taken too much time, or you couldn't figure out
>how to do it in ANSI so you just cooked up some code to finish the
>program.

Probably no-one, because for most real-life tasks, things that
don't exist in ANSI (like hardware, screens, operating systems,
filesystems, widget sets, etc) are needed to make stuff do what
you want. That's not the point. This is a forum for the
discussion of ANSI C (including it's limitations, IMHO). If you
want to talk about real-world programming, then there are other
fora. If you want to talk about UNIX system calls, there's
comp.unix.programmer, Windows, then there's alt.os.ms.* ;-)

Cheers,
Dave.

--

Palamon Technologies Ltd.  Phone +353-1-634-5059      



Tue, 30 Mar 2004 17:24:48 GMT  
 
 [ 23 post ]  Go to page: [1] [2]

 Relevant Pages 

1. slightly OT.

2. slightly OT: cross-platform binary compatibility?

3. Slightly OT: sorting

4. (slightly OT): Static Code Analysis Tool (C++)

5. C portability [slightly OT]

6. slightly OT, but C# curious

7. Style Question (slightly O.T.)

8. (Slightly OT) General ActiveX information?

9. Slightly OT: VC++6, Dikumware 3.08 and Stingray

10. Slightly OT - Class Hierarchy

11. slightly OT.... Joining mpeg files

 

 
Powered by phpBB® Forum Software