__USE_INLINE__

This forum is for general developer support questions.
Post Reply
JosDuchIt
Posts: 291
Joined: Sun Jun 26, 2011 5:47 pm
Contact:

__USE_INLINE__

Post by JosDuchIt »

The OS3 BOOPSI example RKMButClass.c, i worked on,now compiles and works under OS4
I am now trying to get rid of pointer warnings
I do use
#define __USE_INLINE__

So in 'main' i have

struct Gadget *integer, *but;
if (integer = (struct Gadget *)NewObject(NULL,
"strgclass",
GA_ID, 1L,
; ....
TAG_END))
{
if (but = (struct Gadget *)NewObject(rkmbutcl,
...
{

and at cleanup:

DisposeObject(but);
DisposeObject(integer);

I get the warning: passing argument 2 of 'IIntuition->DisposeObject' from incompatible pointer type
for both lines

Looking into the file RKMButClass.e
produced using gcc's -E option
i find the same declarations for but and integer
and the follosing 'Dispose' lines
IIntuition->DisposeObject((but));
IIntuition->DisposeObject((integer));


In the autodoc i found
----

intuition.library/DisposeObject intuition.library/DisposeObject
void DisposeObject(Object *obj);
INPUTS
obj - abstract pointer to a BOOPSI object returned by NewObject().
NAME
}
----
So i tried a cast


DisposeObject((struct Object *)but);
DisposeObject((struct Object *)integer);

Those lines were transformed in the .e file to

IIntuition->DisposeObject(((struct Object *)but));
IIntuition->DisposeObject(((struct Object *)integer));

but i still have exactly the same warnings.

Is it possible at all using the __USE_INLINE__ define and corresponding macro's to avoid those warnings?
User avatar
trixie
Posts: 409
Joined: Thu Jun 30, 2011 2:54 pm
Location: Czech Republic

Re: __USE_INLINE__

Post by trixie »

DisposeObject((struct Object *)but);
DisposeObject((struct Object *)integer);
There is no "struct Object", there is only Object!

As of the latest OS4 SDK, all BOOPSI gadgets and images are to be declared as a pointer to Object, not struct Gadget or Image, respectively. So try something like this:

Object *integer, *but;
if (integer = NewObject(NULL,
"strgclass",
GA_ID, 1L,
; ....
TAG_END))
{
if (but = NewObject(rkmbutcl,
...

If a specific function - like SetGadgetAttrs() - expects a pointer to struct Gadget (instead of an Object), you need to cast:

SetGadgetAttrs( (struct Gadget *) but, window, NULL, ... TAG_END);
The Rear Window blog

AmigaOne X5000 @ 2GHz / 4GB RAM / Radeon RX 560 / ESI Juli@ / AmigaOS 4.1 Final Edition
SAM440ep-flex @ 667MHz / 1GB RAM / Radeon 9250 / AmigaOS 4.1 Final Edition
JosDuchIt
Posts: 291
Joined: Sun Jun 26, 2011 5:47 pm
Contact:

Re: __USE_INLINE__

Post by JosDuchIt »

Thanks Trixie,

The source now compiles without warnings.
I uploaded it here
http://users.online.be/AD/C_Boopsi_RKMButClass.c

I had still to do some more adaptions:

make more explicit declarations:

struct Gadget *integer, *but;
Object *integero, *buto;
struct Message *msgm;
struct IntuiMessage *msgi;

where
but = (struct Gadget *)buto;
integer = (struct Gadget *)integero;

and also
struct Message *msgm;
struct IntuiMessage *msgi;
with appropriate cast :
msgi = (struct IntuiMessage *)msgm;


I also made use of the general layout you used in your Reaction example
User avatar
trixie
Posts: 409
Joined: Thu Jun 30, 2011 2:54 pm
Location: Czech Republic

Re: __USE_INLINE__

Post by trixie »

@JosDuchIt

Thanks. The example might entice me to write a custom ReAction class - something I wanted to try out for quite some time.
The Rear Window blog

AmigaOne X5000 @ 2GHz / 4GB RAM / Radeon RX 560 / ESI Juli@ / AmigaOS 4.1 Final Edition
SAM440ep-flex @ 667MHz / 1GB RAM / Radeon 9250 / AmigaOS 4.1 Final Edition
Post Reply