TIP: Click on subject to list as thread! ANSI
echo: aust_c_here
to: John Gardeniers
from: Adam Fitzpatrick
date: 1996-09-30 08:43:36
subject: ISO vs K&R

Quoting John Gardeniers to Paul Edwards:



PE>It issues warnings.  Even ISO C programs have warnings issued, for all

PE>sorts of things, on different compilers.  A common one is if you go:

PE>if (c = 0) printf("xyz");

 

PE>It's legitimate ISO-C code, but most compilers will issue a warning

PE>that the "c = 0" is suspicious.



JG>Why would that be considered suspicious?



Because it's an assignment where you'd normally expect a comparison.



JG>Perfectly valid code should never be considered suspicious.



It's very easy to make a mistake like that, especially when you're

learning the language. IMHO that's what warnings are there for - to

tell that code is legal, but may not do exactly what you expect it to.

FWIW, I do stuff like that frequently, so I don't want this kind of

warning enabled.



JG>In the end it's the programmer who takes responsibility for his code,

JG>not the compiler.



Of course, but that doesn't mean the compiler shouldn't help identify

potential bugs. And if you don't like it, tell it not to.

 

JG>One thing I've noticed in the C echos, which I've never come

JG>across elsewhere, is the way the standards are virtually a religion

JG>for some (a few) of you.  I'm sure glad nothing like that has ever

JG>happened in assembly language programming.  I think it must be born

JG>in mind that the object of writing a program is to acheive a given

JG>result, NOT to stick to any arbitrary standard.



Perhaps it's because C is meant to be portable, and to be portable it

needs quite a degree of compatibility (ie a standard to be maintained).

Assembly stuff is generally machine-specific. The odd piece of 6502

stuff I've written for the BBC would never work on a C64. Therefore

it's not an issue.

 

JG>A closing comment: ISO would have me re-calibrate the tacho on

JG>my bike so that it reads in radians per second, going by the last

JG>time I had a look at the standards.  I can only assume that my RPM

JG>tacho is an old leftover "K&R" unit :)



Did you have a painful incident involving a standards committee when

you were a child? :) Seriously though, C being standard is a good

thing. Imagine if Basic was _the_ programming language. It's fine if

you only need to use one set of tools on one platform, but otherwise

you're left with quite a bit of work if you need to move from one

environment to another, and even more if you need to use two different

platforms concurrently. C doesn't really have that problem.



... Confucius say, Don't quote me with stupid accent.

--- FMail/Win32 1.20
* Origin: Power BBS - +61-2-858-4114 - Files/Games/EchoMail/Internet (3:711/953)
SEEN-BY: 50/99 620/243 623/630 711/409 410 413 430 808 809 932 934 946 953
SEEN-BY: 711/963 712/515 713/888 714/906 800/1
@PATH: 711/953 410 808 934

SOURCE: echomail via fidonet.ozzmosis.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.