[Search for users]
[Overall Top Noters]
[List of all Conferences]
[Download this site]
Title: | DECC |
Notice: | General DEC C discussions |
Moderator: | TLE::D_SMITH N TE |
|
Created: | Fri Nov 13 1992 |
Last Modified: | Fri Jun 06 1997 |
Last Successful Update: | Fri Jun 06 1997 |
Number of topics: | 2212 |
Total number of notes: | 11045 |
2104.0. "Needconstexpr, with extra level of indirection??" by COMICS::PULLEY () Mon Feb 24 1997 10:43
Hi Folks,
I've a customer trying to upgrade things from DEC C v1.3 to v5.3.
I've tryed a small sample of a program that compiled on v1.3, on
OpenVMS v7.1 Alpha, DEC C v5.5.
It gives the following error:-
%CC-E-NEEDCONSTEXPR, In the initializer for urec_flight_key, "unit_rec_ptr"...
I've not been able to figure if it was right to allow it in the earlier
version, or unreasonable of the compiler not to in teh current.
He's trying a workaround of changing the line it complains about to:-
long *urec_flight_key= &(unit_record.flight_key);
Thanks for any comments or suggestions,
Steve.
This is the little program:-
typedef struct
{
long flight_key;
} unit_record_typedef;
unit_record_typedef unit_record;
unit_record_typedef *unit_rec_ptr=&unit_record;
long *urec_flight_key= &(unit_rec_ptr->flight_key);
void main (void)
{}
T.R | Title | User | Personal Name | Date | Lines |
---|
2104.1 | Use the workaround | DECC::ERICW | | Mon Feb 24 1997 16:03 | 8 |
| The difference can be explained: the 1.3 compiler erroniously accepts the
construct and (yikes) generates incorrect code for it. The 5.* compilers
recognize the bogus construct and issue the error... generating no code at all.
Fortunately, your workaround will make all the compilers do what the programmer
had intended in the first place.
Eric
|