tinycc-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Tinycc-devel] Const copy?


From: Fabrice Bellard
Subject: Re: [Tinycc-devel] Const copy?
Date: Tue, 10 Jun 2003 10:18:52 +0200
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.1) Gecko/20020828

Philippe Ribet wrote:
static const rsoc MRSOC = {
    {
        RSOC_SIZE,
        ....

static void rsoc_malloc(na_env*nae) {
  rsoc* r = ((rsoc*)(se_malloc(RSOC_SIZE)));
  rsoc_count++;
  *r=MRSOC;

I'm quite surprised because tcc refuses to copy const value in non-const
variable. The error message is:
hello_world1.c:1373: cannot cast 'const struct s_rsoc' to 'struct
s_rsoc'

Our aim is to use the const value as a model to initialize the
variable. I do not understand why C rules forget this.

The assignment type check must be incorrect for structures - I will look at it.

Fabrice.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]