#23 structures cannot be passed as function parameters

open
nobody
None
9
2012-01-10
2003-01-25
No

/* Cannot pass/receive structures as parameters. This
is valid C (not prohibited in C99 standard, accepted by
other compilers).
*/

int g;

struct my {
int x;
int y;
};

int f(struct my var) {
g=var.x+var.y;
}

Discussion

  • Johan Knol
    Johan Knol
    2003-01-26

    Logged In: YES
    user_id=63512

    The documentation clearly states that structures can not be
    used in assignments nor can they be passed as function
    parameters.
    There could be a work around, but for now this is a feature
    request, not a bug.

     
  • Johan Knol
    Johan Knol
    2003-01-26

    • labels: 101552 -->
    • milestone: 100454 -->
     
  • Logged In: YES
    user_id=8034

    Sorry, this is not a bug but a feature request. It is
    documented
    in the section 4.6 ANSI-Compliance of the SDCC manual.

     
  • Increasing priority, since I'm encountering more and more software and libraries that rely on full struct support.

     
    • priority: 5 --> 8
     
    • priority: 8 --> 9
     
  • Increasing priority, since aggregate and union handling is currently the main issue that prevents us from compiling ANSI C89 / ISO C90 code.

    Philipp