linux-c-programming.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ron Michael Khu <ronkhu@ntsp.nec.co.jp>
To: linux-c-programming@vger.kernel.org
Cc: Scott <drmemory@3rivers.net>
Subject: Re: Initializer element is not constant
Date: Fri, 21 Jan 2005 10:37:12 +0800	[thread overview]
Message-ID: <41F06AD8.7080206@hq.ntsp.nec.co.jp> (raw)
In-Reply-To: <41F06AC1.2000605@hq.ntsp.nec.co.jp>

Hi,

can u point us to line 124??

I've encountered a similar error message before when i using HP-UX on 
Intel Itanium.
The compiler complained that i used a non-constant in a static array 
declaration...
char a[ maxLen ] ;

in the end, I had to malloc/calloc them... (since i didnt know how to 
tweak or instruct
the compiler to ignore such errors... since the code was already old and 
compilable on
other hp-ux platforms)

-Ron

>
> Scott wrote:
>
>> Hi,
>>
>> It has been a LONG TIME since I've done any programming in C. I have
>> two old programs still in use which were developed on msdos, using the
>> "Mark Williams Let's C" compiler. We're talking 1980's stuff here.
>>
>> Anyway, I thought to try to port them to linux. Can anyone tell me
>> what I'm doing wrong?
>>
>> Here are the relevant portions of indatax.c:
>>
>> char *namectrl = NULL;
>> char *name1 = NULL;
>> char *name2 = NULL;
>>
>> typedef struct {
>>     char *var;    /* destination for storage of the data */
>>     size_t len;    /* max len of the data */
>>     char *(*xlat)();    /* translation routine */
>> } DATUM;
>>
>> DATUM recip_data[] = {
>> {  namectrl, NAMECTRL_LEN, make_upper },
>> {  name1, NAME1_LEN, make_upper },
>> {  name2, NAME2_LEN, make_upper },
>> [...]
>>
>> And these are the errors...
>>
>> indatax.c:124: initializer element is not constant
>> indatax.c:124: (near initialization for `recip_data[0].var')
>> indatax.c:125: initializer element is not constant
>> indatax.c:125: (near initialization for `recip_data[1].var')
>> indatax.c:126: initializer element is not constant
>> indatax.c:126: (near initialization for `recip_data[2].var')
>> [...]
>>
>> gcc version 2.95.3
>>
>> Thanks,
>>
>> Scott Swanson
>> Pendroy, Montana
>> -
>> To unsubscribe from this list: send the line "unsubscribe 
>> linux-c-programming" in
>> the body of a message to majordomo@vger.kernel.org
>> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>>
>>
>>  
>>
>
>



  parent reply	other threads:[~2005-01-21  2:37 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-01-20 23:21 Initializer element is not constant Scott
     [not found] ` <41F06AC1.2000605@hq.ntsp.nec.co.jp>
2005-01-21  2:37   ` Ron Michael Khu [this message]
2005-01-21 16:27     ` Scott
2005-01-21 17:46       ` Ron Michael Khu
2005-01-21 18:54         ` Scott
2005-01-21 19:50           ` Ron Michael Khu
2005-01-21 21:31             ` Scott
2005-01-22 21:12               ` Christoph Bussenius
2005-01-24 20:44                 ` Scott
  -- strict thread matches above, loose matches on Subject: below --
2005-01-24 21:09 Huber, George K RDECOM CERDEC STCD SRI
2005-01-24 21:28 ` Scott

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=41F06AD8.7080206@hq.ntsp.nec.co.jp \
    --to=ronkhu@ntsp.nec.co.jp \
    --cc=drmemory@3rivers.net \
    --cc=linux-c-programming@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).