Skip to main content
gamedev.net
🔒 Locked

Strange Warning...

Started by Galileo430 5 replies 450+ views
Original Post
Galileo430
Galileo430
I was wondering if this warning is a death blow or if it''s like a signed/unsigned mismatch, trivial?
  
global[nGifNumber]->entry = (struct COLORTABLE *)malloc( gdata[nGifNumber].nGCTSize * 3 );

C:\My Documents\C++\gifinter\gifinter.c(316) : warning C4133: ''='' : incompatible types - from ''struct COLORTABLE *'' to ''struct RGBTRIPLET *''

  
------------------------------------------------------------I wrote the best video game ever, then I woke up...
TwoFlower
TwoFlower
What type is global[nGifNumber]->entry ?
It should be struct COLORTABLE * since that''s what you are casting to.
Galileo430
Galileo430
these are the structs

  
struct RGBTRIPLET
{
unsigned char byRed;
unsigned char byGreen;
unsigned char byBlue;
};

struct COLORTABLE
{
RGBTRIPLET *entry;
};
------------------------------------------------------------I wrote the best video game ever, then I woke up...
the Dealy Lama
the Dealy Lama
so, if Global[nGifNumber]->entry is of type RGBTRIPLET *, why are you casting the malloc() to type COLORTABLE *? they are different data types, as one contains three unsigned chars, and the other contains a pointer (long)..

Gruad the Dealy Lama

"What sounds to you like a big bloat of trashy old noise
is in fact the brilliant music of a genius--myself" ~ Iggy Pop
=======================================Matt Welch"What sounds to you like a big bloat of trashy old noiseis in fact the brilliant music of a genius--myself" ~ Iggy Pop
Galileo430
Galileo430
Don''t look at me, I''m a C++ programmer... I don''t use malloc..
------------------------------------------------------------I wrote the best video game ever, then I woke up...
TwoFlower
TwoFlower
quote:
Original post by Galileo430

Don''t look at me, I''m a C++ programmer... I don''t use malloc..


Duh? You''re original code post uses malloc. What are you talking about? Are you mad?

If global[nGifNumber]->entry is not a pointer to a COLORTABLE then you''re code doesn''t make sense and will produce an error.
Galileo430
Galileo430
Ops.. ::smacks self in head::

I am so stupid!
------------------------------------------------------------I wrote the best video game ever, then I woke up...

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.