Re: C Interview Questions



J. J. Farrell said:


Richard Heathfield wrote:

2. When do you say that a digraph is acyclic

What has this to do with C?

C99 has digraphs, and I'd say they're always acyclic.

Bad dog! No biscuit! :-)

5. Which of the Following [functions] is not defined in string.h?

All of them, obviously.

Implementation specific, perhaps? Does anything prevent an
implementation defining them in the header if it chooses to?

I can find no licence in the Standard that allows it. The most relevant
paragraph appears to be:

4.1.2 Standard headers

Each library function is declared in a header, /81/ whose contents
are made available by the #include preprocessing directive. The
header declares a set of related functions, plus any necessary types
and additional macros needed to facilitate their use. Each header
declares and defines only those identifiers listed in its associated
section. All external identifiers declared in any of the headers are
reserved, whether or not the associated header is included. All
external identifiers that begin with an underscore are reserved. All
other identifiers that begin with an underscore and either an
upper-case letter or another underscore are reserved. If the program
defines an external identifier with the same name as a reserved
external identifier, even in a semantically equivalent form, the
behavior is undefined./82/

It seems to me that this does not give permission for implementations to
define standard library functions in standard headers, although it does
mandate that they be declared therein.

--
Richard Heathfield
"Usenet is a strange place" - dmr 29/7/1999
http://www.cpax.org.uk
email: rjh at above domain (but drop the www, obviously)
.



Relevant Pages

  • Re: RFC: cleaning up the in-kernel headers
    ... Much of the compile time is from just parsing the things ... if a header only needs a structure to be declared because it ... declares that structure fully, just doing a ... anything that actually needs to look past the pointer will need ...
    (Linux-Kernel)
  • Re: string
    ... >bitset but declares a function called 'header' that takes ... error C2061: syntax ...
    (microsoft.public.vc.stl)
  • Re: Is using namespace std; valid without namespace std {}; first?
    ... > declares those items in that you need. ... both ANSI C++ compliant compilers, ... but the header files do not use the std namespace. ...
    (comp.lang.cpp)
  • Re: How to print " " or
    ... directive by the entire contents of the header. ... specify the places). ... C89 4.1.2 Standard Headers ... token sequences as being *the* way to refer to the standard headers. ...
    (comp.lang.c)
  • Re: completed my Varaint class.
    ... |> also declares 'size_t'. ... | in my code - this documents the rare occasions where I needed ... then it is the only header ...
    (alt.comp.lang.learn.c-cpp)