P
\(ProteanThread\)
can "stdio.h" be OS specific at the kernal level or ? i know what I'm
trying to ask here but not sure how to word it
trying to ask here but not sure how to word it
can "stdio.h" be OS specific at the kernal level or ? i know what I'm
trying to ask here but not sure how to word it
In comp.lang.c "\(ProteanThread\) said:can "stdio.h" be OS specific at the kernal level or ? i know what I'm
trying to ask here but not sure how to word it
What means "OS specific at the kernal level"? If you have a kernel
header named "stdio.h" it got nothing to do with the file of the
same name used for userland programs. And the userland header also
depends on OS specific properties, the compiler and the libc, so it
won't be identical to a "stdio.h" you get for a different system/
compiler/libc combination.
Minti said:Sorry, could you try to reword your post. I am quite sure many would
like to answer your question.
Arthur J. O'Dwyer said:You mean, what's "inside" <stdio.h>? The answer, as far as this
newsgroup is concerned (i.e., as far as the standard C language is
concerned) is: Whatever the implementor feels like. Could be completely
high-level stuff; could be lines and lines of machine-specific assembly
code; could be a bunch of Unix system calls; could be pink elephants
in tutus. We don't know what <stdio.h> "looks" like on your system, and
we don't care. You don't need to care, either, if all you're doing is
writing programs in C.
If your implementation is like many other implementations, you'll
actually have a text file somewhere on your hard disk called "stdio.h".
If you can find it, open it up and take a look. You'll probably find
out that it's full of arcane, basically incomprehensible pseudo-C with
lots of underscores in funny places. Don't ask us what it means; we
don't know. (Or rather, some of us probably do know what it all means
on /our/ systems, but may have no idea about yours --- and besides, if
we start explaining implementation internals to you, then we'll have to
explain implementation internals to everyone, and there are /hundreds/
of of implementations out there, all different. And then there wouldn't
be any room here to talk about C anymore.)
Bottom line: The implementation of <stdio.h> contains tygers. This
newsgroup doesn't talk about tygers. But if you have questions about
how to use <stdio.h> or the standard library functions it defines,
this is definitely the place to ask.
(ProteanThread) said:So its more compiler dependent than OS dependent?
But if i were designing my own OS, can I create my own custom "stdio.h" lib
?
ok, few more questions:
1. what's a tyger?
Dunno.
2. can the standard library be redefined? (i.e. create my own standard
library?)
3. is "stdio.h" always necessary in plain C?
I'm probably going to be sticking my foot in my mouth with the next
question, but -
Can I create my own subset of the C language with custom library functions?
Walter Roberson said:And where exactly can that charter be found?
comp.lang.c is a rename of a news.* group. It effectively
predates charters. The corresponding news.* group did have a statement
of purpose, but you will, sad to say, get royally roasted if you
post according to that news.* statement of purpose.
Walter Roberson said:You could, but don't expect the result to be portable.
Within the last couple of weeks, there was a thread here in comp.lang.c
to the effect that users are "prohibitted from trying" to redefine
any routine in the standard library. I was the lone holdout for
the interpretation that the standard didn't actually prohibit you
from trying: it just couldn't promise that anything would work
properly if you did.
Jonathan Mcdougall said:Both. You have to differentiate between the
interface (standard) and the implementation (by
essence not standard). The interface is specified
by the C standard and the implementation is
specified by the compiler.
There are many scenarios but here`s one: the OS
implements low-level functions. You have a C
compiler targeted for your system and it comes
with a standard library. What 'targeted' means is
that its C library makes system calls to your
kernel's low-level functions. Porting that
library to another platform will probably not
work, because it is inherently platform-specific,
as the compiler is.
The header should be about the same in all
libraries, because it specifies the interface.
The standard library *must* be implemented for
your platform! It is mandatory for you to
re-implement a working library or to start one
from scratch.
What do you mean exactly? It is necessary if the
program uses declarations from that header.
Yes. For example, Visual C++ adds many extensions
to the C++ language. Just make sure you specify
somewhere what is standard and what is not (and
make sure your standard library's implementation
does not use non-standard feature, as Visual C++
does).
By the way, you should remove comp.lang.c from the
crosspost list since your questions have nothing
to do with it (read its charter).
Walter Roberson said:The old spelling of 'tiger'. On old maps, in places unknown and
potentially dangerous, it was supposedly common to put on the map,
"Beyond here be tygers."
:3. is "stdio.h" always necessary in plain C?
No! The C89 standard says in a footnote,
89. A header is not nessisarily a source file [...]
Jonathan said:(ProteanThread) wrote:
.... snip ...
Dunno.
(ProteanThread) said:1. what's a tyger?
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.