Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
RE: [cdt-dev] Parser: Include handling

Personally I prefer the way it does it now.

To my mind, the header files should be self sufficient, and if I have
not put enough in a header to make that header fully resolved, legal
C/C++ in its own right, then I should be including other headers from
within that header itself.  The yellow annotations are a cue that I need
to do this.

IMHO, if you have a system whereby you have to know that to use the
functions in foo.c in your own source file, you must #include foo.h,
bar.h, stdio.h, and a whole host of stuff, then your system is not very
well designed.  Sooner or later someone will make the mistake of
thinking they can just #include "foo.h", and lo and behold the system
won't build, and they have to spend valuable time sorting out the mess.
There's really no compelling reason I can see why the original developer
can't just put those includes in foo.h for you.

You can make the argument that for a small enough system and small
enough team of developers, you can just make it work the way you say.
But, having had the experience of working on projects where the lines of
code starts approaching a million, I can say that this design approach
does not scale.

My $0.02

Chris Recoskie
Software Designer
IDE Frameworks Group
Texas Instruments, Toronto

> -----Original Message-----
> From: cdt-dev-admin@xxxxxxxxxxx [mailto:cdt-dev-admin@xxxxxxxxxxx] On
> Behalf Of kesselhaus@xxxxxxx
> Sent: Wednesday, March 09, 2005 1:16 PM
> To: cdt-dev@xxxxxxxxxxx
> Subject: [cdt-dev] Parser: Include handling
> Hi folks,
> it most likely doesn't work yet, but will the
> will be able to handle includes a different way than now.
> Here, we do only include files in .c-modules, not .h-files. Though,
> everytime, the parser stumbles over some unknown datatype, its marked
> yellow. Even though, when all includes are handled in the .c-module,
> headers are marked over and over with yellow hints.
> Is there a way, to have the .h-files not parsed on its own, but only
> through
> .c-module-inclusion? If in one module in case of missing inclusions, a
> symbol is not defined, then one can mark the symbol as unkown.
> Though, assuming:
> global.h - typedefs like typedef unsigned char ubyte;
> a.h      - no includes here, e.g. declares ubyte a_func();
> b.h      - here neither, e.g. declares bit b_func(uword uw_b, bit n);
> a.c      - include global.h, a.h (maybe b.h), e.g. uses a_func(),
> b.c      - include global.h, b.h, e.g. uses b_func()
> c.c      - include global.h, whatabout extern ubyte a_func();?
> Regards,
> Henning
> --
> SMS bei wichtigen e-mails und Ihre Gedanken sind frei ...
> Alle Infos zur SMS-Benachrichtigung:
> _______________________________________________
> cdt-dev mailing list
> cdt-dev@xxxxxxxxxxx

Back to the top