#267 (c99) support assign value to struct variable


I can't assign one variable to another variable which has some struct type.

example :
typedef struct
int i;
char c;
} someStructType;

someStructType struct1, struct2;
void main
struct1.i = 1;
struct1.c = 'a';
struct2 = struct1; // can't pass compiler here

please help me, thank you!


  • steven

    steven - 2008-11-22
    • assigned_to: nobody --> bernhardheld
  • steven

    steven - 2008-11-22
    • assigned_to: bernhardheld --> borutr
  • Maarten Brock

    Maarten Brock - 2008-11-22

    This is not supported and documented in the manual as such under Ansi compliance.
    As a workaroud you can use memcpy.

    And please do not assign this to any developer. It is up to the developers to take this up or not.

  • Maarten Brock

    Maarten Brock - 2008-11-22
    • assigned_to: borutr --> nobody
  • steven

    steven - 2008-11-23

    thanks, I need this feature to port ucosii, and i think it's look ugly to use memcpy.

  • b-s-a

    b-s-a - 2010-11-11

    I agree with lgge1. Why here is this strange limitation? Can you simply implement it via __buildin_memcpy?

  • Philipp Klaus Krause

    The limitation is there since no one implemented assignment of aggregate types yet.

    I'm closing this item since it's a duplicate of #1710546.


  • Philipp Klaus Krause

    • assigned_to: nobody --> spth
    • status: open --> closed
  • Maarten Brock

    Maarten Brock - 2011-04-19

    I guess part of the reason it is unsupported is related to passing a struct as a function parameter or function result value.


Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

No, thanks