Proof of concept: automatically import C header files
H. S. Teoh
hsteoh at quickfur.ath.cx
Wed Jul 17 15:20:13 PDT 2013
On Wed, Jul 17, 2013 at 12:46:54PM -0700, Walter Bright wrote:
> On 7/17/2013 9:48 AM, deadalnix wrote:
> >My understanding is that we only want to convert declaration to D.
> >Can you give me an example of such corner case that would require the
> >full frontend ?
>
> One example:
>
> --------------------------------
> //**************************Header**********************\\
>
> int x;
> --------------------------------
>
> Yes, this POS is real C code I got a bug report on. Note the
> trailing \\. Is that one line splice or two? You have to get the
> hairy details right. I've seen similar nonsense with trigraphs. I've
> seen metaprogramming tricks with token pasting. You can't dismiss
> this stuff.
I've seen C code where the "header" file has function bodies in them.
Though about trigraphs... I've to admit I've never actually seen *real*
C code that uses trigraphs, but yeah, needing to account for them can
significantly complicate your code.
But as for preprocessor-specific stuff, couldn't we just pipe it through
a standalone C preprocessor and be done with it? It can't be *that*
hard, right?
T
--
Bare foot: (n.) A device for locating thumb tacks on the floor.
More information about the Digitalmars-d
mailing list