harmony-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mika Miettinen <mika.mietti...@elisanet.fi>
Subject Re: compiling bootJVM with MSVC
Date Fri, 04 Nov 2005 10:26:26 GMT
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

View raw message