EmbeddedRelated.com
Forums
The 2024 Embedded Online Conference

Whay is a C compiler ANSI compatible?

Started by Bobby September 11, 2007
Why is it important for a C compiler to be "ANSI compatible"? Does that have any special
advantage with my code?



On Sep 11, 1:27 pm, "Bobby" <bob2...@yahoo.com> wrote:
> Why is it important for a C compiler to be "ANSI compatible"?
Why is it important for you language to be English compatible when speaking to a unilingual Anglophone? Think about using multiple compilers from multiple vendors targeted at multiple architectures and using multiple tools to generate, edit and analyze the code over multiple projects. Conversely, consider if you only use a single compiler with no associated tools only targeted at a single architecture then do you even care if it's a C compiler? If you do what defines whether it is C or not? Assuming, of course, you are not wanting to get into a discussion of ISO/ANSI and the differences between the latest and previous standards.
> Does that have any special > advantage with my code?
How long is a piece of string? Robert
On 2007-09-11, Bobby <bob2222@yahoo.com> wrote:

> Why is it important for a C compiler to be "ANSI compatible"?
So you can honestly call it a "C compiler."
> Does that have any special advantage with my code?
If you write ANSI compatible code it does: it means the compiler can compile your code. A compiler that can't compile your code is a waste of bits. -- Grant Edwards grante Yow! Here we are in America at ... when do we collect visi.com unemployment?
Bobby wrote:
> Why is it important for a C compiler to be "ANSI compatible"? Does that have any special > advantage with my code? >
If you want your code to be portable, and if you want to hire programmers to help you out without having to train them up on your particular version of C, you want ANSI compatibility. -- Tim Wescott Wescott Design Services http://www.wescottdesign.com Do you need to implement control loops in software? "Applied Control Theory for Embedded Systems" gives you just what it says. See details at http://www.wescottdesign.com/actfes/actfes.html
Tim Wescott wrote:

> Bobby wrote: > >> Why is it important for a C compiler to be "ANSI compatible"? Does >> that have any special >> advantage with my code? >> > If you want your code to be portable, and if you want to hire > programmers to help you out without having to train them up on your > particular version of C, you want ANSI compatibility. >
And if your code may some day have to withstand the scrutiny of agencies such as FDA or FAA it might become even more important. -- Regards, Joerg http://www.analogconsultants.com
"Tim Wescott" <tim@seemywebsite.com> wrote in message 
news:pt6dnZXBjouaeXvbnZ2dnUVZ_vHinZ2d@web-ster.com...
> Bobby wrote: >> Why is it important for a C compiler to be "ANSI compatible"? Does that >> have any special >> advantage with my code? >> > If you want your code to be portable, and if you want to hire programmers > to help you out without having to train them up on your particular version > of C, you want ANSI compatibility.
That doesn't guarantee portability though, does it? tim
"Tim Wescott" <tim@seemywebsite.com> wrote in message
news:pt6dnZXBjouaeXvbnZ2dnUVZ_vHinZ2d@web-ster.com...
> Bobby wrote: > > Why is it important for a C compiler to be "ANSI compatible"? Does that have any
special
> > advantage with my code? > > > If you want your code to be portable, and if you want to hire > programmers to help you out without having to train them up on your > particular version of C, you want ANSI compatibility.
I thought that ANSI compatibility referred to the _output_ of the C compiler?
On 2007-09-11, Bobby <bob2222@yahoo.com> wrote:

>>> Why is it important for a C compiler to be "ANSI compatible"? >>> Does that have any special advantage with my code? >>> >> If you want your code to be portable, and if you want to hire >> programmers to help you out without having to train them up on >> your particular version of C, you want ANSI compatibility. > > I thought that ANSI compatibility referred to the _output_ of > the C compiler?
It does in so much as it specifies the behavior of a compiled program for a given input. -- Grant Edwards grante Yow! Everybody gets free at BORSCHT! visi.com
tim..... wrote:

> That doesn't guarantee portability though, does it?
Depends on how strictly your code limits itself to ANSI compliance. The important case is the opposite one, though: code not compliant to ANSI standards is effectively guaranteed to be non-portable.
On Tue, 11 Sep 2007 21:04:54 +0100, tim..... wrote:

> "Tim Wescott" <tim@seemywebsite.com> wrote in message > news:pt6dnZXBjouaeXvbnZ2dnUVZ_vHinZ2d@web-ster.com... >> Bobby wrote: >>> Why is it important for a C compiler to be "ANSI compatible"? Does that >>> have any special >>> advantage with my code? >>> >> If you want your code to be portable, and if you want to hire programmers >> to help you out without having to train them up on your particular version >> of C, you want ANSI compatibility. > > That doesn't guarantee portability though, does it? >
No, but it makes it a lot more possible. With care you can write nice, portable code in ANSI standard C. You can even make it talk to hardware with minimal work on the part of the user if you make well defined interfaces to driver code that takes care of all the non-portable bits. -- Tim Wescott Control systems and communications consulting http://www.wescottdesign.com Need to learn how to apply control theory in your embedded system? "Applied Control Theory for Embedded Systems" by Tim Wescott Elsevier/Newnes, http://www.wescottdesign.com/actfes/actfes.html

The 2024 Embedded Online Conference