1752625 Members
4578 Online
108788 Solutions
New Discussion юеВ

Re: DEC warnings

 
Malleka Ramachandran
Frequent Advisor

Re: DEC warnings

the second one...
John Gillings
Honored Contributor

Re: DEC warnings

Malleka,

OK, here's what I mean by a short reproducer!

main(){
globalvalue int X;
struct Y {unsigned short a;};
static struct Y readonly Z[]={X};
}



Your NDMEVL$* symbols, defined in NDM$EVENT_TYPE.H are all "globalvalue int". They're used to initialize elements of the array EVENT_DESCRIPTION_TABLE. Elements are of type "event_description_entry", and the initialized fields "type" and "class" are both declared as "unsigned short".

This is a type mismatch. You're trying to fit an int into a short.

If these were COMPILE TIME constants, the compiler could check that the "int" values fit into a "short" field, and warn you if there was any truncation.

Since, "globalvalue" are LINK TIME constants, it's up to the linker to do the initialization and possibly truncation of the value, again with a warning if data was lost. However, if those symbols are resolved from a shareable image, instead of an object module, then they're RUN TIME constants, and performing the correct initialization, truncation & warning is way beyond the capabilities of the image activator.

This is what the compiler is warning you about.

So, if you KNOW absolutely that these values will never exceed the size of a "short" field, then ignore the warning. If not, then you'd be better off defining the fields to be "int" instead of "short". Alternatively, you could define the symbols as "globalvalue short". It all depends on where and how the values of the symbols are defined. You should be able to determine that from the linker MAP file.

Bottom line is, you need to resolve the type mismatch to make the compiler happy.

From the look of the code, I'd say changing "type" and "class" to "unsigned int" should be safe. It will make the table slightly bigger, but memory is cheap! The only potential problem is if there is code that assumes the fields are "short" (but, judging by the coding style, the programmer knew exactly what they were doing, and I'd guess there are no such dependencies).

(and if that effort isn't worth a few points, I don't know what is! :-)
A crucible of informative mistakes
Malleka Ramachandran
Frequent Advisor

Re: DEC warnings

Thanks, John, it worked.
Arch_Muthiah
Honored Contributor

Re: DEC warnings

Mallega,
your profile shows, you assigned points to only one out of 15 responses.

> I have assigned points to 1 of 15
> responses to my questions.

Please try to spend time to assign the points.


Archunan
Regards
Archie
Malleka Ramachandran
Frequent Advisor

Re: DEC warnings

I think this software does not work as expected. Yesterday I assigned points to all responses to DEC C warnings before I responded to John saying it works. But now it shows all responses as unassigned. This could have happened with all previous responses too. Please let me know if someone knows how to fix this. I no longer see a drop down list so I can go ahead and assign points again.

Thanks,
Malleka
Kris Clippeleyr
Honored Contributor

Re: DEC warnings

Malleka,

You seem to have 2 profiles:

This is the one you used to start this thread:

http://forums1.itrc.hp.com/service/forums/publicProfile.do?userId=CA1290226&forumId=1

This one, you used in your last reply:

http://forums1.itrc.hp.com/service/forums/publicProfile.do?userId=CA1341125&forumId=1

You have to log in using the CA1230226 profile in order to be able to assign points.

Regards,
Kris (aka Qkcl)
I'm gonna hit the highway like a battering ram on a silver-black phantom bike...
Jan van den Ende
Honored Contributor

Re: DEC warnings

Yes,

Not only do you have two IDs, but those also have different names: CA1230226 is "Malleka",
where CA1341125 is "Malleka Ramachandran"

Proost.

Have one on me.

jpe
Don't rust yours pelled jacker to fine doll missed aches.