473,508 Members | 2,249 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

glib/gtk and the standard

intro:
i have a simple c program that uses gtk (1.2) which in turn uses glib.

using the flag -Wall i get no warnings.
using -Wall -ansi no warnings.
using -Wall -ansi -pedantic I get these warnings

In file included from /usr/include/gtk-1.2/gdk/gdktypes.h:33,
from /usr/include/gtk-1.2/gdk/gdk.h:31,
from /usr/include/gtk-1.2/gtk/gtk.h:31,
from buncha_buttons.c:1:
/usr/include/glib-1.2/glib.h:1308:23: warning: ISO C does not permit
named variadic macros

/usr/include/glib-1.2/glib.h:1311:25: warning: ISO C does not permit
named variadic macros

/usr/include/glib-1.2/glib.h:1314:26: warning: ISO C does not permit
named variadic macros

/usr/include/glib-1.2/glib.h:1317:25: warning: ISO
C does not permit named variadic macros

In glib.h, line 1308 I find:

#define g_error(format...) g_log (G_LOG_DOMAIN, \
G_LOG_LEVEL_ERROR, \
format)

the other lines are similar #define statements.

question: what is named variadic macros? should the glib guys fix this?
should I upgrade and face the newest problems? should I just don't care
because who uses glib/gtk will never respect the standard? did I miss
some useful information on this matter? thanks for any input on this.

--
daniel
Nov 13 '05 #1
3 4803
Daniel C Bastos <da****@slashlog.org> wrote:
intro:
i have a simple c program that uses gtk (1.2) which in turn uses glib. [...] /usr/include/glib-1.2/glib.h:1308:23: warning: ISO C does not permit
named variadic macros [...] In glib.h, line 1308 I find:

#define g_error(format...) g_log (G_LOG_DOMAIN, \
G_LOG_LEVEL_ERROR, \
format)

the other lines are similar #define statements.

question: what is named variadic macros?
It apparently refers to the way that the variadic portion of the macro's
arguments is named "format" here. The standard-compliant way of writing
that macro definition would be:

#define g_error(...) g_log (G_LOG_DOMAIN, \
G_LOG_LEVEL_ERROR, \
__VA_ARGS__)
should the glib guys fix this?
Well, it doesn't seem to require much work to fix it, so I'd say "yes".
Especially if glib is intended to be compilable on non-gcc compilers.
should I upgrade and face the newest problems? should I just don't care
because who uses glib/gtk will never respect the standard? did I miss
some useful information on this matter? thanks for any input on this.


I think that's really up to you. It's trivial to fix those macros
yourself, if that's what you want to do.

- Kevin.

Nov 13 '05 #2
Michael B Allen <mb*****@ioplex.com> wrote (06 Jul 2003) in
news:pa*********************************@ioplex.co m / comp.lang.c:
Variadic macros are macros that accept a variable number of
arguments. They are defined in the C99 standard but not many
compilers impement them and I don't think gcc uses the defines C99
syntax anyway.


gcc handles at least all the example vararg macros from the C99
standard. Could you give an example of a C99 vararg macro that gcc
does not handle correctly? I don't doubt that there may be some.
Since I use the standard vararg mechanism for macros found in the
standard and do so with gcc, I would like to be sure that I don't
shot myself in the foot.

--
Martin Ambuhl
Returning soon to the
Fourth Largest City in America
Nov 13 '05 #3
In <Xn*********************************@207.217.77.22 > Martin Ambuhl <ma*****@earthlink.net> writes:
Michael B Allen <mb*****@ioplex.com> wrote (06 Jul 2003) in
news:pa*********************************@ioplex.c om / comp.lang.c:
Variadic macros are macros that accept a variable number of
arguments. They are defined in the C99 standard but not many
compilers impement them and I don't think gcc uses the defines C99
syntax anyway.


gcc handles at least all the example vararg macros from the C99
standard. Could you give an example of a C99 vararg macro that gcc
does not handle correctly? I don't doubt that there may be some.
Since I use the standard vararg mechanism for macros found in the
standard and do so with gcc, I would like to be sure that I don't
shot myself in the foot.


Since http://gcc.gnu.org/gcc-3.0/c99status.html claims that C99 macros
with a variable number of arguments are properly supported, it is
reasonable to assume that any 3.x version handles them properly.

OTOH, gcc also supports the GNU C syntax for vararg macros, which is
different from the C99 syntax.

Dan
--
Dan Pop
DESY Zeuthen, RZ group
Email: Da*****@ifh.de
Nov 13 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
2620
by: Arjan | last post by:
Hi, I want to open a serial port (COM1) in my Windows program (C), and I would like to use the Glib IOchannels to do this. Does anybody know how to do this? Examples maybe? Thanks in advance,...
0
1091
by: TPJ | last post by:
Is there a place to talk about problems with the GLib library? I was looking for something on www.gtk.org, but all I found were some mailing lists about GTK+.
1
3193
by: manish deshpande | last post by:
Hi, When i'm installing MySQL-server-standard-5.0.24a-0.rhel3.i386.rpm by the following command: rpm -i MySQL-server-standard-5.0.24a-0.rhel3.i386.rpm the following error is being shown: ...
1
5666
by: Loic Mahe | last post by:
Hello, I would like to compile GLib as a static library on Windows XP with MinGW if possible. I downloaded GLib and needed librairies, but only the .dll files are included in the zip file. ...
1
2231
by: lumpybanana247 | last post by:
~~~"glib.h: No such file or directory. "~~~ I am using DevC++ to compile a program and it says "glib.h: No such file or directory. " I do not have any parameters set up, but it does appear...
10
3841
by: akappa | last post by:
Hi, I want to serialize a glib data type (an hash), but I don't want to access directly to the fields of the various structs, since it's an opaque data type: there is one "more-or-less standard...
1
1769
by: ramasubramanian.rahul | last post by:
hi people.. dont know if this the right forum for this doubt ... so sorry if i am mis-posting... i was looking at the way glib 2.10.3 does export optimization using a list of "to be exposed"...
37
9011
by: Michael Palmer | last post by:
As anyone knows, the state of Python GUI programming is a little fractured at this time, with many toolkits, wrappers and meta-wrappers dead and alive, with or without documentation. I've come...
4
4604
by: MN | last post by:
Hi all, I'm learning how to use some Glib-functions for simple linked list. I wrote a small program that prepends 2 data (let's say to integers "1" and "2") in list, display them, count total...
0
7123
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7326
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7498
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
5053
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4707
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3182
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1557
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
766
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
418
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.