Re: OT: C declaration syntax Re: generics and arrays and multi-class collections



On Thu, 04 Oct 2007 16:53:02 -0700, Patricia Shanahan <pats@xxxxxxx>
wrote:

xen wrote:
I don't like the way the variable declarations have their type mixed
with the variable name, that is, a pointer is not char* p, but char
*p, and an array of char ptrs is char *p[], and a ptr to an array is
char (*p)[], but it kinda makes sense because that's also the way
you're going to use the variable.

Take a look at cdecl, e.g. http://www.linuxcommand.org/man_pages/cdecl1.html

On the one hand, it makes writing C declarations relatively easy. On the
other hand, the fact that such a program exists implies that C
declaration syntax is confusing.

Patricia


My god, I hadn't even imagined that declarations could be so complex.

void (*signal(int x, void (*y)(int )))(int ) { }

But I'm sure they can be much, much complexer.
.



Relevant Pages

  • Re: pointers
    ... declarations of this form into real C so they can be compiled. ... pointer to pointer to char) ... I'm still not sure what syntax would be best for definitions with initialisations. ...
    (comp.lang.c)
  • andersons equivalence method
    ... equivalences with ALGOL like or pascal like declarations and ... EQTO x: pointer to arrayfunction returning pointer ... array of pointer to function returning char ...
    (comp.lang.c)
  • Re: ora-600 with table...cast... on 10.2.0.3 / al32utf8 / linux
    ... so it may seem logical that declarations of VARCHAR2s ... with CHAR size semantics that may exceed 32Kb limit shouldn't be ... variable-length code point encodings, like UTF-8? ... actually allocating memory Oracle seems to be preparing for the worst ...
    (comp.databases.oracle.server)
  • Re: ora-600 with table...cast... on 10.2.0.3 / al32utf8 / linux
    ... so it may seem logical that declarations of VARCHAR2s ... with CHAR size semantics that may exceed 32Kb limit shouldn't be ... variable-length code point encodings, like UTF-8? ...
    (comp.databases.oracle.server)
  • Re: More structs
    ... int { ... Your phrase "similar ``non-struct'' declarations" I find ... void foo; ...
    (comp.lang.c)