Amiga.org
Operating System Specific Discussions => Amiga OS => Amiga OS -- Development => Topic started by: Jose on September 04, 2004, 11:53:04 PM
-
Guess I'm invading these forums :-) I'm getting an error like that about amiga.lib in the linking stage now...
There was another error left that complained about invalid types for assignment in the following assignment for a Tagitem array's tagitem (the name for the CreateNewProc() function):
TagsforCrtNewPr[1].ti_Data = Buffertaskname
I have defined Buffertaskname as:
char *Buffertaskname = "MDBuffer"
;
I solved this with casting Buffertaskname to ULONG in the previous assignment. Is this correct?
Oh, and this:
printf("Exec Version is %d.%d\n",SysBase->LibNode.lib_Version,SysBase->LibNode.lib_Revision)
gets a warning saying that the string is suspicious :-)
Bare with me a little 8-)
-
I solved this with casting Buffertaskname to ULONG in the previous assignment. Is this correct?
Yes.
gets a warning saying that the string is suspicious
I'd say that's just vbcc being silly.
-
@Piru
Hey:-)
@all
Been trying but still getting that "undefined reference to utilitybase error".
I have opened utility.library and put the base in a variable declared as:
struct Library *UtilityBase;
so that's not the error.
Error checking to check if the library is opened is also included...
-
Hi Jose,
Jose wrote:
Oh, and this:
printf("Exec Version is %d.%d\n",SysBase->LibNode.lib_Version,SysBase->LibNode.lib_Revision)
gets a warning saying that the string is suspicious :-)
This warning is part of VBCC's format string checking (as the name implies). It's quite strict.
You are using %d in your string, so VBCC checks that the arguments corresponding to this are of type 'int'. If they are not, you get this warning.
Theres a lot of templates, but the most generally used ones are
%d (also %i) : int
%ld (also %li) : long int
%lu : unsigned long int
%h : short int
%hu : unsigned short int
%c : char
%s : char* (C string)
%f : double
%x : hex, lower case - unsigned int
%X : hex, upper case - unsigned int
VBCC compares all the above (and more) with your arguments. The values you are passing are not explicitly "int", therefor it flags a warning that %d is suspicious.
-
Yes, but the makers of VBCC didn't consider some cases where the types have to be different.
E.g. compilers on the Amiga (and VBCC is no exeption) always put longwords on the stack.
So the following example will not work:
void main (void)
{
short a = 5;
printf ("a = %h\n",a)
}
Instead it must be %d or %ld which is warned as "suspicius" by VBCC.
Bye,
Thomas