[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Which programming Language



On Mon, 9 Feb 2009 10:19:01 -0500
"Douglas A. Tutty" <dtutty@vianet.ca> wrote:

> On Sun, Feb 08, 2009 at 05:00:54PM -0600, Boyd Stephen Smith Jr. wrote:
> > On Sunday 08 February 2009 11:04:42 Martin wrote:
> > > On Sat, Feb 07, 2009 at 10:24:58PM -0600, Boyd Stephen Smith Jr. wrote:
>  
> > > And C standard is one that leaves many features implementation
> > > defined, unspecified or undefined!
> > 
> > That's on purpose, for two reasons: (1) to support multiple competing 
> > implementations, (2) to document where implementations are allowed to
> > differ so programmers can avoid them if they so choose.
> > 
> > >   y += y+++--y;
> > 
> > This results in implementation-specific behavior since you are modifying a 
> > single variable twice with no sequence point in between.
> > 
> > >   printf("x=%d y=%d z=%d\n", x, y, z);
> > 
> > More implementation-specific behavior as z has not be initialized.
> > 
> > > Two compiler that I installed on Debian (gcc, tcc) gives different result.
> > 
> > Different implementations are allowed to have different behavior in this
> > case. It's not a flaw with the standard to support multiple
> > implementations; it's a feature.  If the programmer wants consistent
> > results across implementations, they can avoid the constructs that the
> > standard says have undefined or implementation-specific behavior.
> 
> 
> The problem with implementation-specific stuff in C is that it is
> allowed to varry so much from one implementation to another that you get
> such unportable behaviour where this isn't technically necessary.
> 

At least the example given two mails up is in my opinion and attempt to abuse
an edge case in the standard.

My experience is that with borderline sane programing readable code (at least
to the point where it is maintainable) you don't really run into problematic
contradictions in the standard (and I have some experience with dirty
programming, to the point that a boss once told be to change gcc since it was
giving a warning not to do something specified by operator precedence and he
didn't like it)

> This was addressed in the Ada standard.  It says of the main langauge,
> basically that all implementation have to do such-and-such.  It then
> says that there are optional things that every implementation doesn't
> have to have, but if it chooses to have it, it has to be done in a
> specific way.
> 
> I really suggest that the OP read Understanding Programming Languages by
> M. Ben-Ari.  It is freely available on the internet (or I can email it,
> its under 1 MB).  It talks about programming lanagues in the abstract
> and contrasts and compares C, C++, Ada, Java, and the more historical
> languages where appropriate, such as FORTRAN, COBOL, Pascal, Smalltalk,
> PL/1, etc.

Just for the record, Fortran is very much alive and kicking. It's actually a
wonderful language for mathematical work and HPC. It's just no longer a hype
word. And I'm mostly talking about fortran 90/95. Fortran 77 is a bit archaic.
I am hoping that a fortran 2008 compiler will come out soon and that has object
oriented paradigms. Maybe part of the problem is the lack of a
cheap/free/accessible compiler for windows as the intel compiler rather
expensive, but HPC is much more linux/unix based anyway.


> 
> Doug.
> 
> 


Reply to: