You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This builds fine with gcc and clang, but building with wcc I get the following errors:
$ wcc test.c
Open Watcom C x86 16-bit Optimizing Compiler
Version 2.0 beta Jun 1 2024 01:58:31 (32-bit)
Copyright (c) 2002-2024 The Open Watcom Contributors. All Rights Reserved.
Portions Copyright (c) 1984-2002 Sybase, Inc. All Rights Reserved.
Source code is available under the Sybase Open Watcom Public License.
See https://github.com/open-watcom/open-watcom-v2#readme for details.
test.c(10): Error! E1070: Data for aggregate type must be enclosed in curly braces
test.c(10): Error! E1054: Expression must be constant
test.c(10): Error! E1009: Expecting ',' but found ';'
test.c(12): Error! E1063: Missing operand
test.c(12): Error! E1054: Expression must be constant
test.c(12): Error! E1009: Expecting ';' but found 'void'
test.c: 15 lines, 0 warnings, 6 errors
This has many peculiar error messages. E1054 is odd because the expression on line 10 is constant but I think that is a result of E1070 happening first.
The text was updated successfully, but these errors were encountered:
Are you sure that is it? Setting C99 mode gives the same errors:
$ wcc -zastd=c99 test.c
Open Watcom C x86 16-bit Optimizing Compiler
Version 2.0 beta Jun 1 2024 01:58:31 (32-bit)
Copyright (c) 2002-2024 The Open Watcom Contributors. All Rights Reserved.
Portions Copyright (c) 1984-2002 Sybase, Inc. All Rights Reserved.
Source code is available under the Sybase Open Watcom Public License.
See https://github.com/open-watcom/open-watcom-v2#readme for details.
test.c(10): Error! E1070: Data for aggregate type must be enclosed in curly braces
test.c(10): Error! E1054: Expression must be constant
test.c(10): Error! E1009: Expecting ',' but found ';'
test.c(12): Error! E1063: Missing operand
test.c(12): Error! E1054: Expression must be constant
test.c(12): Error! E1009: Expecting ';' but found 'void'
test.c: 15 lines, 0 warnings, 6 errors
I'm no C expert, but doesn't using a structured variable complicate things unnecessarily? Just use a simple var:
#include <stdio.h>
const int j = 123;
int i = j;
int main ( void ) {
// int i = j; /* to init local vars works even with wcc386 */
printf("i = %u\n", i );
return( 0 );
}
This also gives error 'Expression must be constant'. And the "expression" is indeed NOT a constant, but a variable with the "constant" modifier. For my understanding: to initialize a global variable with the contents of another global variable would require some "constructor", which is called before main() runs (hence, if you use wpp386 instead of wcc386, the code above is accepted without error). Is this really covered by C99?
Initializing a struct is valid C99 but does not work with WATCOM. For example,
This builds fine with
gcc
andclang
, but building withwcc
I get the following errors:This has many peculiar error messages. E1054 is odd because the expression on line 10 is constant but I think that is a result of E1070 happening first.
The text was updated successfully, but these errors were encountered: