English Amiga Board

English Amiga Board (https://eab.abime.net/index.php)
-   Coders. C/C++ (https://eab.abime.net/forumdisplay.php?f=118)
-   -   VBCC: complain about static int (*calltrap)(...) = (int (*)(...))0xF0FF60; (https://eab.abime.net/showthread.php?t=86409)

mbergmann-sh 16 March 2017 06:10

VBCC: complain about static int (*calltrap)(...) = (int (*)(...))0xF0FF60;
 
HELP appreciated! What's wrong with this declaration:

Code:

static int (*calltrap)(...) = (int (*)(...))0xF0FF60;
vbcc moans it as "error 0 - declaration expected", while SAS/C, StormC v3 eat it as beeing OK.

How do I have to rewrite this statement in order to get vbcc to come clear with it?

Thanks in advance,

Michael

alpine9000 16 March 2017 07:36

Quote:

Originally Posted by mbergmann-sh (Post 1147204)
HELP appreciated! What's wrong with this declaration:

Code:

static int (*calltrap)(...) = (int (*)(...))0xF0FF60;
vbcc moans it as "error 0 - declaration expected", while SAS/C, StormC v3 eat it as beeing OK.

How do I have to rewrite this statement in order to get vbcc to come clear with it?

Thanks in advance,

Michael

GCC gives us a more descriptive error:

Code:

error: ISO C requires a named argument before ‘...’
So for me the following compiles in gcc:

Code:

static int (*calltrap)(int, ...) = (int (*)(int, ...))0xF0FF60;
Sorry I can't test with vbcc, my install is borked at the moment.

mbergmann-sh 16 March 2017 08:41

Quote:

Originally Posted by alpine9000 (Post 1147211)
GCC gives us a more descriptive error:

Code:

error: ISO C requires a named argument before ‘...’
So for me the following compiles in gcc:

Code:

static int (*calltrap)(int, ...) = (int (*)(int, ...))0xF0FF60;
Sorry I can't test with vbcc, my install is borked at the moment.

Well big thanks! Since this is part of uae_pragmas.h from e-uae src, I guess I'll have to rewrite that module in order to compile. Should be the samm with vbcc... :D

phx 17 March 2017 01:19

A function with just one varargs argument makes not much sense in ANSI/ISO-C. The va_arg() macro requires the name of the last argument before the '...' to work.


All times are GMT +2. The time now is 04:42.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.

Page generated in 0.07038 seconds with 11 queries