T.R | Title | User | Personal Name | Date | Lines |
---|
1275.1 | feature | CXXC::ZAHAREE | Linda D. Zaharee | Tue Mar 18 1997 08:28 | 20 |
| Actually, this is a feature. Old C behavior allowed you to use members
of other structures or unions. When doing this, the other structure
member's offset and type are used. This is DECC's behavior in both
common and vaxc modes.
When compiling your program in vaxc mode you should have seen the
following diagnostic:
$ cc/stand=vaxc decc_bugs_1275.c
memset(&vp_struct->field1, 0, sizeof(t_struct3));
..........^
%CC-I-OTHERMEMBER, In this statement, "field1" is a member of another
struct or union.
at line number 34 in file C2$:[ZAHAREE.TEMP]DECC_BUGS_1275.C;3
This tells you that "field1" was not a member of the structure
"vp_struct", but came from another structure.
Linda.
|
1275.2 | Sorry but I don't agree | UTRTSC::DORLAND | The Wizard of Odz2 | Wed Mar 19 1997 09:30 | 17 |
| I am puzzled. I have a pointer (vp_field) to a structure called
t_struct4.
I try to perform something with a field (vp_struct->whatsoever).
Whatsoever is not defined anywhere in t_struct4. So this is
a clear error. The fact that whatsoever is used in a totally
different structure should not make any difference.
Try to run this program , and it will give problems whenever
you do something with vp_field->whatsoever.
Also, there is a difference between VAX and Alpha, on Alpha
you don't get even an informational when using /STAND=VAXC.
(Tested with V5.5 on both Alpha and VAX).
I still think the compiler should definitely give an error
on this statement.
Regards
|
1275.3 | | DECC::ZAHAREE | Linda D. Zaharee | Wed Mar 19 1997 09:52 | 34 |
| Well, I can't say I really like the feature either, but since
traditional C compilers did this, DECC was forced to support
it in the appropriate modes.
I'm not sure why you're not seeing the informational on Alpha.
When I try it, I do. Maybe you have informationals turned off?
Here's what I get on Alpha:
$ cc/version decc_bugs_1275.c
DEC C V5.5-002 on OpenVMS Alpha V6.2-1H3
$ cc/stand=vaxc decc_bugs_1275.c
memset(&vp_struct->field1, 0, sizeof(t_struct3));
..........^
%CC-I-OTHERMEMBER, In this statement, "field1" is a member of another struct or union.
at line number 34 in file C2$:[ZAHAREE.TEMP]DECC_BUGS_1275.C;3
Here's what I get on VAX:
$ cc/version decc_bugs_1275.c
DEC C V5.5-002 on OpenVMS VAX V6.2
$ cc/stand=vaxc decc_bugs_1275.c
memset(&vp_struct->field1, 0, sizeof(t_struct3));
..........^
%CC-I-OTHERMEMBER, In this statement, "field1" is a member of another struct or
union.
At line number 34 in C2$:[ZAHAREE.TEMP]DECC_BUGS_1275.C;3.
%VCG-I-SUMMARY, Completed with 0 error(s), 0 warning(s), and
1 informational messages.
At line number 43 in C2$:[ZAHAREE.TEMP]DECC_BUGS_1275.C;3.
Linda.
|
1275.4 | version is 7.1... | UTRTSC::DORLAND | The Wizard of Odz2 | Thu Mar 20 1997 04:44 | 10 |
| Well , I am running VMS 7.1 on the Alpha so that may make difference:
$ cc/version bug
DEC C V5.5-002 on OpenVMS Alpha V7.1
$ cc/stand=vaxc bug
$
Ton Dorland
|
1275.5 | VMS version shouldn't affect this | WIBBIN::NOYCE | Pulling weeds, pickin' stones | Thu Mar 20 1997 08:10 | 3 |
| What does $SHOW SYMBOL CC show?
You haven't done a $SET MESSAGE/NOFAC/NOID/NOSEV/NOTEXT , have you?
|
1275.6 | Why are you using /STAND=VAXC? | DECC::VOGEL | | Thu Mar 20 1997 11:14 | 12 |
|
To add to what Linda has said: When you specify /STAND=VAXC then
the compiler will try to do exactly what VAX C did. In cases
such as this, VAX C would issue an informational message and compile
the program. The DEC C V5.5 behavior matches that.
Why are you using /STAND=VAXC? If you do not use it, you'll get
the error you expect.
Ed
|