Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 29 Dec 2006 00:58:21 +0200
From:      Giorgos Keramidas <keramida@ceid.upatras.gr>
To:        deeptech71@gmail.com
Cc:        freebsd-questions@freebsd.org
Subject:   Re: where to get the iso c90 compiler?
Message-ID:  <20061228225821.GA18015@kobe.laptop>
In-Reply-To: <45941C69.5020601@gmail.com>
References:  <4592E8EA.6010402@gmail.com> <4592EC6E.9090302@FreeBSD.org> <4592F190.2000206@gmail.com> <20061228135224.GA2463@kobe.laptop> <45941C69.5020601@gmail.com>

Next in thread | Previous in thread | Raw E-Mail | Index | Archive | Help
On 2006-12-28 20:35, deeptech71@gmail.com wrote:
>Giorgos Keramidas wrote:
>> Does the lang/gcc41 port work for you?
>
> I don't know I don't care.

Ok, then.

> I want to learn more about compilation processes, get to know
> UNIX-like systems more, and whatever.

That's ok too.  You are bound for a very fun ride, even if it takes
years to realize that it never ends, though :)

> So I've downloaded the source for gcc, and the README says that I need
> the ISO C90 compiler.

There is no "ISO C90 compiler".  There is an ANSI/ISO standard for the
"C Programming Language", which is _implemented_ by some compilers.

You already have an installation of the GNU C compiler (GCC), installed
as the system compiler of your FreeBSD system.  This installation of GCC
includes support for some of the standards related to the C Programming
Language.  You can find out more about the standards supported by your
installation of GCC, by running:

    % info gcc

In the "info browser" that pops up, follow the "Standards:" link and you
can read a lot of details about the various language standards supported
by your GCC installation.

> Where do I get that?

You have it already.  See the "info" documentation of GCC.

In short, you can get GCC to run in a special mode, which is almost
conforming to the ISO9899:1990 standard for the C language.  This mode
is enabled by the options:

    % gcc -ansi -pedantic ...

or by the equivalent set of options:

    % gcc -std=c89 -pedantic ...

In this mode, GCC will produce diagnostic messages for all non-ISO
programs, with only one notable exception, documented in its manual
(see the section `Options Controlling C Dialect'):

    The alternate keywords `__asm__', `__extension__',
    `__inline__' and `__typeof__' continue to work despite
    `-ansi'.  You would not want to use them in an ISO C program,
    of course, but it is useful to put them in header files that
    might be included in compilations done with `-ansi'.
    Alternate predefined macros such as `__unix__' and `__vax__'
    are also available, with or without `-ansi'.

This minor exception means that GCC, even with the options mentioned
above is *NOT* 100%-conforming to the C90 standard, but it is so close
to a fully-conforming implementation of a C90 compiler, that you will
hardly ever notice, unless you use one of the extensions listed above.

> OK it looks like I can compile gcc 4.1 with an older gcc, but that's
> not my choice.

I don't know why you feel that this is not a good choice, but if you go
through the info documentation of GCC and *still* feel this way, then
I'd be interested to know why :)

> [ But if that's the case, how was the first gcc compiled? xD ]
> [ How was the first ever compiler compiled? xD ]

This process is called "compiler bootstrapping".  Google for it, and you
will be amazed at how it works :-)

Regards,
Giorgos




Want to link to this message? Use this URL: <http://docs.FreeBSD.org/cgi/mid.cgi?20061228225821.GA18015>