CompuServe Thread

#tagItem init?

8 messages in this thread
#22035From: SyndesisMar 25, 1992 11:09 PM
I've been wondering how to get around a warning in the Manx compiler. AmigaDOS 2.0 introduces the 'struct tagItem', a struct containing essentially two ULONGs. A snippet of Commodore code, presumably for the Lattice compiler, initializes a tagItem with code like { VALUE, (ULONG)"string" }, casting the pointer to those characters to a ULONG. I can see how it can do that, but with my usual set of ANSI and warning options on Manx, it doesn't allow this. Is there a way I can get around it, and let this code compile at all? It complains that the initializer is not a constant. The only way I've been able to get around it is to initialize the second half of the tagItem with an explicit assignment in the code, as opposed to initializing it during compilation.
#22042From: John Toebes/SYSOPMar 26, 1992 6:19 AM
That is a known bug with Manx. I was under the impression that there was one generation of a 5.2 update that fixed it. You will need to contact them about it.
#22045From: Charles ConlowMar 26, 1992 10:49 AM
John: Using Manz Aztec 5.2a, I can successfully compile, without any warnings, the following ( snippet of )code… #include <exec/types.h> #include <utility/tagitem.h> struct TagItem myTags[ ] = { { PAIN , TRUE }, { DEATH, FALSE }, { TAXES, !TRUE }, { TEXT, "Some Text Here" } }; I can't imagine doing what's up at your end. Charles Conlow – via Whap!
#22071From: John Toebes/SYSOPMar 27, 1992 5:47 AM
The problem is with the cast. Without the cast, you will get a warning/error out of SAS/C and with the cast you get a compile error out of Manx. At one point in time, the cast would crash SAS/C.
#22055From: William CageMar 26, 1992 6:27 PM
Maybe I am doing something wrong here too, but I have the same problems with SAS/C v5.10b. Only some tag items appear to be vulnerable. If I am setting up a window using the tags in the following manner: struct TagItem WindowTags[] = { WA_Left, 0, … … …etc WA_Title, "My Window", …etc TAG_DONE } I will get an error (not warning) about invalid constant or something. I have to change the code to: WA_Title, 0l, and then in the body of my code have: WA_Title.ti_Data = (Tag)"My Window"; /* (Tag) rids incompatible warnings */ And all is well. Only the tags with string values seem to be a problem. Bill – via Whap!
#22067From: Jeff PrattMar 27, 1992 1:11 AM
Hi, Bill, I get the same thing with the TAG_ITEMS, but found a different workaround: WA_Left, 0, . . . WA_Title, &"My Window", /* <— the "&" */ . . . Also, saying WA_xxxxx.ti_Data = (ULONG)something /* … struct GList *something… */ got me past another warning. I came across these while trying to compile code generated by a pd program "GadToolsBox" (which works really well, by the way, otherwise ) (( I only have SAS/C v5.10 )) … a message Whap!'ed from scenic Boring, Oregon by Jeff P.
#22072From: John Toebes/SYSOPMar 27, 1992 6:09 AM
Part of the reason that you get away with it is due to a bug in SAS/C 5.10 which was fixed in 5.10A. The & accidentally shuts off some error checking. You really need to get the latest update.
#22092From: William CageMar 27, 1992 5:55 PM
My it is a small world, I found the problem with GadToolsBox also. Maybe we ought to look at the source to see if it can be corrected there. It really is nice. Bill – via Whap!