Talk About Network



Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > C > C Declarations
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 2 Topic 26057 of 26198
Post > Topic >>

C Declarations

by "Bartc" <bc@[EMAIL PROTECTED] > May 4, 2008 at 07:44 PM

I need to be able generate C-style declarations from a specification (I
call 
it a typespec) in left-to-right form (as it might be expressed in
English).

What is the algorithm, or where can I found the algorithm, to do so?

I have looked at some code in K&R2 p126 ('undcl'), but that works on 
character input (I already have the typespec in internal form).

And I've heard of something called cdecl.c but that seems to be 2000 lines
+ 
headers which I'm not keen to delve into; I expect the code to be very 
simple, once I know it..

Simple Examples:

Input               Outputs (with and without embedded name)

'Array 3 of int'    int x[3]     int[3]

'Pointer to char'   char *x      char*

But this needs to work with arbitrary typespecs.

-- 
Thanks,

Bartc.




 2 Posts in Topic:
C Declarations
"Bartc" <bc@  2008-05-04 19:44:24 
Re: C Declarations
"Bartc" <bc@  2008-05-05 00:05:30 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Wed May 14 2:37:40 CDT 2008.