Re: .h for standard headers

From: P.J. Plauger (pjp_at_dinkumware.com)
Date: 05/20/04


Date: Thu, 20 May 2004 12:47:19 GMT


"Old Wolf" <oldwolf@inspire.net.nz> wrote in message
news:843a4f78.0405192227.2c16cc2f@posting.google.com...

> "Duane Hebert" <spoo@flarn2.com> wrote:
>
> > grep "somefunctionname" *.h is a sight better than grep
> > "somefunctionname" *.* when I'm looking for a function
> > declaration in a header file.
>
> "grep foo *.*" will not find things in files that don't contain a dot
> (except on retarded filesystems).

And even there, you're at the mercy of the particular tool. It is a
rare system that has the equivalent of the old Unix /etc/glob, which
uniformly expanded wild-card patterns on a command line for all
comers. NB: There is such a critter with the MKS Toolkit, but
heaven help you if you try to make sense out of it. Just try
contriving a wild-card pattern that matches only files with no .*
suffix. This would all be a non-problem if the C++ Committee had
settled on *any* .xx suffix, even if they wanted to get away from .h.

> Why not list all your implementation's
> standard headers into a file (that won't ever need to change),

What planet do you live on? They change regularly. In particular,
the subset of headers you want to look at on any given occasion
changes all the time. You can't make a problem go away by redefining
it out of existence.

> and then
> you can go:
>
> grep foo *.h `cat stdhdrs`

which doesn't exactly roll trippingly off the tongue even if stdhdrs
is in your current directory (looking like a C++ header file, I
might add).

> or make an alias or small script to do that. If you want to search
> headers in many directories (eg. if you're working on a project with
> 3rd party libraries) regularly, you have to do something like this anyway.

No I don't. The beauty of the shell language developed so many
decades ago is that it is a) terse and b) easy to type correctly.
(It is also c) easy to encapsulate in scripts, but that's another
dimension.) None of the kludges proposed to make up for the loss
of the suffix satisfy either a) or b).

P.J. Plauger
Dinkumware, Ltd.
http://www.dinkumware.com



Relevant Pages

  • Re: vector
    ... entirely possible to look at the header file, see the defined methods, and ... to look in headers to see how they work. ... iterators that _are_ the key to the entire standard library by design. ... containers, algorithms and functions. ...
    (microsoft.public.vc.mfc)
  • Re: organizing mulitple source files
    ... > The only function in main.c is mainand it requires certain headers ... > associated with the library functions at the top of main.c and I added ... > my custom header file for the secondary function. ... for the compiler not to complain about it. ...
    (comp.lang.c)
  • Re: header files & #includes
    ... If header file A includes ... I usually put standard headers first, third party headers next, ...
    (comp.lang.cpp)
  • Re: C++ by nmake
    ... > The error points to the missing string.h header file. ... > to prepare the envitronment variable, but found no trace to this file in ... Sounds like your problem is referencing the old .h headers. ...
    (microsoft.public.dotnet.languages.vc)
  • Re: .h for standard headers
    ... convenient way that's now gone for C++ headers. ... > shell that can give you a list of all files that have a specific ... that have no .xx suffix. ... > Windows just happens to use. ...
    (comp.lang.cpp)