BSD C Compiler to recompile many lines of K&R Whitebook C.

Sergei Akhmatdinov sakhmatd at riseup.net
Fri Jan 20 22:42:25 UTC 2017


On Fri, 20 Jan 2017 21:40:29 +0000
spirals <spirals at eircom.net> wrote:
> Hi All, I am a newcomer to your list, with a rather unusual question, 
> and this is definitely not a windup folks.
Maybe more of a freebsd-hackers question here, but here will do. :)

> How far back in BSD releases would I need to get (the source code to 
> build)  a C compiler that will accept "bog standard" K&R Whitebook C 
> (1st ed), rather than throwing the thousands of warnings and error 
> messages the current gcc on Linux 7 (Wheezy) is doing.
You may wish to try compiling with -traditional or -c89, much of pre-ANSI K&R
should be compatible.

Out of curiosity, is there a specific reason you want to compile pre-ANSI K&R?
Not to say there wouldn't be any, just curious myself. K&R 2nd ed was rewritten
for ANSI.

> I ask this as I understand from reading the documents the FreeBSD 
> compiler is based on gcc.
FreeBSD uses clang + llvm. Since gcc is licensed under GPL, clang doesn't
reuse any gcc code.

> I have not yet installed FreeBSD, but asking this question as part of a 
> process of evaluating evaluating it, based on this specific requirement 
> to compile K&R C.
> 
> The K&R C consists of many lines of code known to compile clean and run 
> OK when it was originally written.
Since the original K&R was written, ANSI was created to avoid the assembly
language problem of having a million different standards.

If your goal is to learn C, go for the ANSI-fied version of K&R.

Cheers,
-- 
Sergei Akhmatdinov

My GPG public key:
gpg --keyserver pgp.mit.edu --recv-keys AD800D99
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 833 bytes
Desc: OpenPGP digital signature
URL: <http://lists.freebsd.org/pipermail/freebsd-questions/attachments/20170120/886a0ddb/attachment.sig>


More information about the freebsd-questions mailing list