"B. K. Oxley \(binkley\)" <[EMAIL PROTECTED]> writes:

> From: "Ned Konz" <[EMAIL PROTECTED]>
> 
> > I don't think you can drop the argument names in the definition of a C
> > subroutine. You can in C++, though. Or in the declaration of a
> subroutine.
> > But aren't we talking about a definition here?

No.  I was specifically talking about Inline building a wrapper given
*only* a declaration (a la Swig, and yes, I am a heretic, but at least
I'm trying to get better).

> Yes.  Declarations needs type information only.  Definitions need
> variable names only (types default to ever-popular int -- if you are on
> an IP platform [sizeof(int) == sizeof(void*)], this means you can pass
> pointers in as well :-).
> 
> This is bad practise, but quite legal.  GCC just compiled this for me:
> 
> foo(a,b) { return a+ b; }
> int main () { return foo(1, 2); }

This is not ANSI C.  For one thing, the definition of foo() is K&R C
(and you could get away with "main()" without that confusing "int"
before it, too!).  Note that a and b don't have types, so by what I
think used to be called the "Miranda" rule they're implicitly ints.

I think these used to be valid definitions of x,y,z as ints:

   x,y,z;

Look in http://www.ioccc.org for many more examples of this type of
code.


However, personally I'm *not* interested in K&R C.  For one thing,
there's insufficient type information in a declaration to wrap it (you
could parse the *definition*, though).

What I *do* want is to be able to feed Inline with the header file for
one of my libraries (or even a third-party library).  Of course, I'd
probably have to preprocess it somehow.

See Swig (http://www.swig.org/ might be working again) for details.

--
Ariel Scolnicov        |"GCAAGAATTGAACTGTAG"            | [EMAIL PROTECTED]
Compugen Ltd.          |Tel: +972-2-5713025 (Jerusalem) \ We recycle all our Hz
72 Pinhas Rosen St.    |Tel: +972-3-7658117 (Main office)`---------------------
Tel-Aviv 69512, ISRAEL |Fax: +972-3-7658555    http://3w.compugen.co.il/~ariels

Reply via email to