K
Kenny McCormack
Finally, someone in c.l.c. who has used all compilers.
Man, have I got a lot of questions for you.
Good one!
Finally, someone in c.l.c. who has used all compilers.
Man, have I got a lot of questions for you.
Wolfgang.Draxinger said:Because you may be able to compile and link without the C standard
library functions being available. Like when boostrapping the standard
library or implementing a operating system kernel, where the standard
library functions simply won't work. All compilers/linkers offer a
option, not to link against the standard library.
DOS 1 was, as Tommy notes, basically a quick hack-up of CP/M, but
DOS 2 introduced a lot of Unixy stuff and made DOS quite Unix-like.
I do not mean "based" in the sense of "code based" - i.e., that they took
Unix code to build DOS. Only a moronic pedant would think that - which is
why we are seeing so much of it in this thread. See: "straw man".
I mean "based" in the sense of "ideas borrowed from". And I mean borrowed
rather heavily - not just a smidgen here and there.
It all depends on what the meaning of the word "based" is.
It is obvious to anyone with two brain cells to rub together that DOS
imitates Unix:
- the current directory is . and the parent ..
- forward slash separation of paths (but backslash also).
- command pipes denoted by |
- redirection with < and >
- some similar commands like "cd"
- devices (COM1: LPT1: CON ...) in the file namespace
- ...
The better question would be why the C standard library function
prototypes aren't all automatically available, without a bunch of
#include's. To me it seems like they ought to be, but the people
writing the standards and the people writing the compilers don't agree
with me, so they aren't.
The most obvious answer is that it would cause problems whenever new
functions were added to the standard library ...
A perfect case in point is <stdbool.h>; lots of folks were already using
"bool" to refer to their own boolean typedef, so putting the standard
boolean typedef in its own header was the only workable solution.
Also, while it is not required, the usual way of implementing the
standard headers is for them to be actual files just like any other
header. Automatically including them means that those files would have
to be processed even if the code didn't actually need them.
I thought the standard boolean type was _Bool? Then it shouldn't be any
problem unless the user naughtily used _Bool for his own type (and
presumably with his own reasons for deliberately choosing such an
ugly-looking type name).
tom st denis said:On Jan 27, 9:43Â am, (e-mail address removed) (Kenny McCormack)
wrote: [snip]
So not only are your posts tiresome and boring but they're wholesale
factually incorrect even when you are trying to be a smarty pants.
It is obvious to anyone with two brain cells to rub together that DOS
imitates Unix:
- the current directory is . and the parent ..
- forward slash separation of paths (but backslash also).
- command pipes denoted by |
- redirection with < and >
- some similar commands like "cd"
- devices (COM1: LPT1: CON ...) in the file namespace
- ...
James Kuyper said:Yes, _Bool is the standard name, but <stdbool.h> contains something
equivalent to
typedef _Bool bool;
The better question would be why the C standard library function
prototypes aren't all automatically available, without a bunch of
#include's. To me it seems like they ought to be, but the people
writing the standards and the people writing the compilers don't agree
with me, so they aren't.
Most languages had input and output statements. Many had special builtOne day, C was just a language. People wrote some utility functions.
Most languages had input and output statements. Many had special built
in functions.
C was a bit different. Everything in the language proper mapped to two
or three assembly instructions. Everything else was a function. There
was no difference between user-defined functions and built in ines,
and virtually every function could be implemented in C.
The library grew up with the language, however.
Ian Collins said:The library also grew to be pretty big in comparison with the "standard"
library. On early machines there wasn't any hardware floating point
support and RAM was a precious resource, so a separate library made sense.
It is obvious to anyone with two brain cells to rub together that DOS
imitates Unix:
- the current directory is . and the parent ..
- forward slash separation of paths (but backslash also).
- command pipes denoted by |
- redirection with < and >
- some similar commands like "cd"
- devices (COM1: LPT1: CON ...) in the file namespace
- ...
"Stephen Sprunk" <[email protected]> wrote in message
Automatically including them means they needn't be files at all.
All
those definitions can just pre-exist in the compiler. (That's if
compilers don't already work like that: by seeing 'stdio.h' and turning
on those definitions rather than go to the trouble of processing an
actual file.) Obviously there would need to be mechanism to turn off or
override any built-in definitions with user-supplied headers.)
Perhaps I no longer understand what the purpose of a linker is, but I
thought that they extracted only the functions that were needed from a
library (and any further functions that *they* depend on). It was not
necessary to load the entire library. So linking in a maths module should
not make the program any bigger, if no maths functions are actually used.
I thought the standard boolean type was _Bool? Then it shouldn't be any
problem unless the user naughtily used _Bool for his own type (and
presumably with his own reasons for deliberately choosing such an
ugly-looking type name).
Automatically including them means they needn't be files at all. All
those definitions can just pre-exist in the compiler. (That's if
compilers don't already work like that: by seeing 'stdio.h' and turning
on those definitions rather than go to the trouble of processing an
actual file.) Obviously there would need to be mechanism to turn off or
override any built-in definitions with user-supplied headers.)
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.