#344 "error 48: cannot assign values to aggregates" feature need

closed-duplicate
nobody
None
5
2012-02-06
2011-12-06
Oleg N. Cher
No

Dear SDCC developers,

I use Ofront "Oberon-2 to C" translator for my projects.
It produces clean and good C text, that compiles,
of course, very good. Quote little doc on Ofront:

"In order to support a wide range of C compilers,
Ofront is parametrizable to support virtually all
existing compilers, be they ANSI or Kernighan/
Ritchie (K&R) style compilers."

Please, look at this sample of code:

typedef
struct Card {
char suit;
char rank;
} Card;

Card card1, card2;

int main (void)
{
card1 = card2;
return 0;
}

SDCC does not like this way:
"error 48: cannot assign values to aggregates"

Yes, I know what can help. We need to rewrite
this code, so:

int main (void)
{
card1.suit = card2.suit;
card1.rank = card2.rank;
return 0;
}

And it is not bad, but Ofront generates C program
automatically, and not settings to do this way
possible.
I didn't see in C standards, but it is a good idea
if SDCC will be support this additional (or standard?)
feature. It allows use Ofront with SDCC more comfortable.

And, please, make sure that this feature is not described
exactly in ANSI and K&R standards.

Thank you very much.
Oleg N. Cher,
Vedanta software.
allot ]at[ bk.ru

Discussion

  • Oleg N. Cher
    Oleg N. Cher
    2011-12-06

    P.S. Of course, Borland C++ Builder (v5.0), Visual C++ (v6.0), GCC/MINGW and even old Microsoft QuickC v.2.51 and Borland Turbo C (2.01) compile the sample good, and with no warnings.

     
  • Duplictate of RFE #1710546.

    Philipp

     
    • labels: 101552 -->
    • status: open --> closed-duplicate