4 ms·
It may be unusable for “modern” operating systems (you could write an early UNIX clone with just ISO C because early UNIX didn’t support much). But that’s basi
by maxlybbert 5y ago
It may be unusable for “modern” operating systems (you could write an early UNIX clone with just ISO C because early UNIX didn’t support much).
But that’s basically always been the case. I doubt you could stay within the first ISO C standard and write a modern operating system.
- phicoh 5y agoAssuming that an early Unix clone would be written in C plus some amount of assembler. Then what constructs of modern Unix systems make it impossible to in write in the first ISO C standard plus some assembler? For example, 4.4BSD, early Solaris have just about everything you would expect in a modern operating system. And give the age of those systems, they were written in early versions of the C standard.
- immibis 5y agoThis is true for any language. An operating system can be written in Java plus some amount of assembler.
- ErikCorry 5y agoBefore 1985 there was no C standard, and until 1989 it was only a draft. So I doubt anything was written in standard C in the 1970s or early 1980s.
- phicoh 5y agoC89 is mostly a superset of K&R C. So if you can write an OS in K&R you can write it is C89. The issue was, do modern operating systems require newer versions of the C standard? Or can you write everything in C89.
- maxlybbert 5y ago(Duplicating an answer to a similar question): The C standard has notes about a freestanding implementation, mainly for developing kernels. The requirements C has for freestanding environments are very limited ( http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1570.pdf http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1570.pdf , you get float.h, iso646.h, limits.h, stdalign.h, stdarg.h, stdbool.h, stddef.h, stdint.h, and stdnoreturn.h) and the starting point for the program is implementation defined; you might get _Atomic, but that’s optional). For the record, C++ goes a little overboard and promises all sorts of things in its freestanding environment. https://groups.google.com/g/comp.std.c/c/zzyii-DlMiU/m/RnH5iO3keCMJ https://groups.google.com/g/comp.std.c/c/zzyii-DlMiU/m/RnH5i...
- andyjohnson0 5y ago> I doubt you could stay within the first ISO C standard and write a modern operating system. Do you take that view because of some intrinsic deficiency in the language, or the difficulty of memory safety, or something else?
- maxlybbert 5y agoThe C standard has notes about a freestanding implementation, mainly for developing kernels. The requirements C has for freestanding environments are very limited ( http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1570.pdf http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1570.pdf , you get float.h, iso646.h, limits.h, stdalign.h, stdarg.h, stdbool.h, stddef.h, stdint.h, and stdnoreturn.h) and the starting point for the program is implementation defined; you might get _Atomic, but that’s optional). For the record, C++ goes a little overboard and promises all sorts of things in its freestanding environment. https://groups.google.com/g/comp.std.c/c/zzyii-DlMiU/m/RnH5iO3keCMJ https://groups.google.com/g/comp.std.c/c/zzyii-DlMiU/m/RnH5i...