Google does not seem to shed any light on this topic - But the question is quite simple:

Is the FreeBSD (Or any BSD) CodeBase ANSI (c89) Compliant, or does it use c99, c11 or non-standard features like the Linux Kernel Does?

  • 3
    It depends on what you mean by "compliant": all contain gcc-isms which have been adopted by clang, and all use compiler directives not in c89. Mar 19, 2016 at 13:06
  • 2
    The straight answer is no: you can't write an OS in pure C (no way to access hardware, for example). The intersting answer, which I don't know, is the portability policy of the FreeBSD project. Mar 19, 2016 at 16:35
  • @Gilles When you say there would be no way to access the hardware, do you mean you would need things like POSIX standard functions? Even if (Free)BSD uses POSIX functions, are those functions not written in pure c code? Sorry If I sound a bit stupid :) Don't really have much experince with Kernel Hacking and such
    – Ankush
    Mar 19, 2016 at 21:39
  • 1
    @Ankush You can't access hardware with only pure C or even with only POSIX. You need at the very least to be able to access various architecture-dependent registers and to access memory addresses where hardware is mapped. Mar 20, 2016 at 12:19
  • 1
    Is that done using assembly? If so would it be better to ask if all the code in FreeBSD that is written in c is strict ANSI?
    – Ankush
    Mar 21, 2016 at 4:47

1 Answer 1


The guidelines presented in the FreeBSD Developers' Handbook encourage the developer to write portable code. For example, the suggestion (in 2.4. Compiling with cc) that the C programmer use compiler warnings to check for problems:

Generally, you should try to make your code as portable as possible, as otherwise you may have to completely rewrite the program later to get it to work somewhere else—and who knows what you may be using in a few years time?

% cc -Wall -ansi -pedantic -o foobar foobar.c

This will produce an executable foobar after checking foobar.c for standard compliance.

However the Committer's Guide does not make a point of requiring that contributions follow a given standard. The relevant points in that guide are social rather than technical, e.g.,

On the other hand, the FreeBSD Porter's Handbook does mention POSIX, as a goal (see 12.18. Use POSIX Standards).

All in all, because there is advice but no discussion of reviews to ensure compliance, their codebase will likely be "mostly" POSIX, but with exceptions due to the usual causes (error, opinion, etc).

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .