[antlr-interest] Autiomatic header file generation for C/C++??

Voelkel, Andy andy.voelkel at plantronics.com
Thu Mar 22 08:58:02 PDT 2012


Not really. Have you looked at the makeheaders program? It has several modes of operation, and one of them gives you explicit control of which interfaces are "published". This is of course an essential element of any such tool. The main problem with the makeheaders tool is that it is very old, and C++ has moved on, adding namespaces and templates and such. Makeheaders could probably also be redesigned in a cleaner way, given modern technology. But there is some clever stuff in there.

I've been bugged by the whole header file thing since C++ was introduced. I suppose I was corrupted by the time I spent at Symbolics, but the modern examples of Java and C# show that header files are not necessary when assemblies contain the right metadata. This is somewhat orthogonal to other Java/C# features such as automatic storage management and reflection.

I actually think that C++ could have be fixed along the way to allow headerless program, but it wasn't. As a result, any tool to retrofit a fix will inevitably have some shortcomings. But not as many as manual header file maintenance.

And an Eclipse based plug-in which does this would remove almost all the pain (after the learning curve of whatever additional syntax is necessary to control header file generation).

I do have a question about the existing Eclipse feature you describe, though. Suppose you _change_ an existing prototype in a header file during design, after you've written some implementation code and you discover (for instance) the need for an additional argument to a method. Is the Eclipse feature smart enough to take you to the existing implementation code, and add the additional argument to the argument list, rather than assuming that this is a new method and asking you to create a whole new method? This is the kind of problem that I would imagine you'd run into with such a tool - incremental interface design becomes very messy. Is it better than I imagine?

- Andy

________________________________________
From: antlr-interest-bounces at antlr.org [antlr-interest-bounces at antlr.org] on behalf of Jim Idle [jimi at temporal-wave.com]
Sent: Wednesday, March 21, 2012 5:46 PM
Cc: antlr-interest at antlr.org
Subject: Re: [antlr-interest] Autiomatic header file generation for C/C++??

I think that you are misunderstanding [some of] the point of adding the
prototype to the header file. There is a reason that Eclipse cdt allows
you to generate the function from the prototype and not the other way
around. If you just auto produce the header files, then you make all the
functions visible everywhere at once.

Jim

> -----Original Message-----
> From: antlr-interest-bounces at antlr.org [mailto:antlr-interest-
> bounces at antlr.org] On Behalf Of Voelkel, Andy
> Sent: Wednesday, March 21, 2012 4:02 PM
> To: Eric
> Cc: antlr-interest at antlr.org
> Subject: Re: [antlr-interest] Autiomatic header file generation for
> C/C++??
>
> Hi,
>
> I took a look a more detailed look at that and lzz. I prefer the
> approach of makeheaders - unfortunately it is old enough that it does
> not understand namespaces. Still, for a project that does not need
> namespaces, it might just work.
>
> I find it AMAZING that C/C++ programmers put up with the hassle of
> manual header file maintenance, and that no other tool seems to be in
> widespread use.  Last time I checked it was 2012, not 1985.
>
>
> -          Andy
>
> From: Eric [mailto:researcher0x00 at gmail.com]
> Sent: Tuesday, March 20, 2012 5:00 PM
> To: Voelkel, Andy
> Cc: antlr-interest at antlr.org
> Subject: Re: [antlr-interest] Autiomatic header file generation for
> C/C++??
>
> Hi Andy,
>
> FWIW I did a quick search and found makeheaders.
>
> Eric
> On Tue, Mar 20, 2012 at 7:49 PM, Voelkel, Andy
> <andy.voelkel at plantronics.com<mailto:andy.voelkel at plantronics.com>>
> wrote:
> Hi,
>
> Does anyone know of any tools for generating C/C++ header files
> automatically from an annotated version of the C/C++ source files? I
> really hate writing and maintaining header files in C/C++.
>
> This isn't strictly related to Antlr, other than the fact that Antlr
> would be a logical front end for such a tool. But I thought that the
> same types that hang out in Antlr-land might know about such things.
>
>
> -          Andy
>
> ________________________________
>
> CONFIDENTIALITY NOTICE: This e-mail transmission, and any documents,
> files or previous e-mail messages attached to it, may contain
> information that is confidential and/or legally privileged. If you are
> not the intended recipient, or a person responsible for delivering it
> to the intended recipient, please DO NOT disclose the contents to
> another person, store or copy the information in any medium, or use any
> of the information contained in or attached to this transmission for
> any purpose. If you have received this transmission in error, please
> immediately notify the sender by reply email or at
> privacy at plantronics.com<mailto:privacy at plantronics.com>, and destroy
> the original transmission and its attachments without reading or saving
> in any manner.
>
> For further information about Plantronics - the Company, its products,
> brands, partners, please visit our website
> www.plantronics.com<http://www.plantronics.com>.
>
> List: http://www.antlr.org/mailman/listinfo/antlr-interest
> Unsubscribe: http://www.antlr.org/mailman/options/antlr-interest/your-
> email-address
>
>
> ________________________________
>
> CONFIDENTIALITY NOTICE: This e-mail transmission, and any documents,
> files or previous e-mail messages attached to it, may contain
> information that is confidential and/or legally privileged. If you are
> not the intended recipient, or a person responsible for delivering it
> to the intended recipient, please DO NOT disclose the contents to
> another person, store or copy the information in any medium, or use any
> of the information contained in or attached to this transmission for
> any purpose. If you have received this transmission in error, please
> immediately notify the sender by reply email or at
> privacy at plantronics.com, and destroy the original transmission and its
> attachments without reading or saving in any manner.
>
> For further information about Plantronics - the Company, its products,
> brands, partners, please visit our website www.plantronics.com.
>
> List: http://www.antlr.org/mailman/listinfo/antlr-interest
> Unsubscribe: http://www.antlr.org/mailman/options/antlr-interest/your-
> email-address

List: http://www.antlr.org/mailman/listinfo/antlr-interest
Unsubscribe: http://www.antlr.org/mailman/options/antlr-interest/your-email-address


________________________________

CONFIDENTIALITY NOTICE: This e-mail transmission, and any documents, files or previous e-mail messages attached to it, may contain information that is confidential and/or legally privileged. If you are not the intended recipient, or a person responsible for delivering it to the intended recipient, please DO NOT disclose the contents to another person, store or copy the information in any medium, or use any of the information contained in or attached to this transmission for any purpose. If you have received this transmission in error, please immediately notify the sender by reply email or at privacy at plantronics.com, and destroy the original transmission and its attachments without reading or saving in any manner.

For further information about Plantronics - the Company, its products, brands, partners, please visit our website www.plantronics.com.


More information about the antlr-interest mailing list