That seems to be a reasonable explanation. And I don't see
any problem if it's changed to look more like C. ;-)
bye,
Sebastian
Mika Miettinen wrote:
> Enrico Migliore wrote:
>
>>
>
>> Right now I got some problems which I'm planning to solve during the
>> weekend,
>> here are two examples:
>>
>> --------------------------------------------------------------------------------------
>>
>> rvoid argv_init(int argc, char **argv, char **envp)
>> {
>> rchar *chkjh;
>> chkjh = (rchar *) rnull;
>> rchar *chkcp; <--- MSVC flags this as a compilation error
>>
>> ..\jvm\src\argv.c(127) : error C2275: 'rchar' : illegal use of this
>> type as an expression
>> --------------------------------------------------------------------------------------
>
>
>
> I remember banging my head into this same kind of problem some years
> ago. You must always put variable definitions at the start of the
> block; so the start of the function should probably go like this:
>
> rvoid argv_init(int argc, char **argv, char **envp)
> {
> rchar *chkjh = (rchar *) rnull;
> rchar *chkcp = (rchar *) rnull;
> rchar *chkbcp = (rchar *) rnull;
> ...
>
> The problem is that
> chkjh = (rchar *) rnull;
> is no longer an initialization, it is an assignment and these
> two are different beasts altogether.
>
> I seem to remember ANSI C requires this definitions-at-the-start
> behaviour and MSVC seems to do it by the book. Hope I'm not
> mistaken (I haven't actually used MSVC for quite some time).
>
> -- Mika
>
>