473,804 Members | 4,408 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_ERR OR, \
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 4821
Daniel C Bastos <da****@slashlo g.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_ERR OR, \
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_ERR OR, \
__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******** *************** **********@iopl ex.com / 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*****@earthl ink.net> writes:
Michael B Allen <mb*****@ioplex .com> wrote (06 Jul 2003) in
news:pa******* *************** ***********@iop lex.com / 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
2649
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, Arjan
0
1114
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
3229
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: warning: MySQL-server-standard-5.0.24a-0.rhel3.i386.rpm: V3 DSA signature: NOKEY, key ID 5072e1f5 file /etc/my.cnf from install of MySQL-server-standard-5.0.24a-0.rhel3 conflicts with file from package mysql-3.23.58-1 file...
1
5688
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. I manage to create a static lib project with CodeBlocks IDE. and I manage to use Glib as a dynamic lib but not as a static one.
1
2250
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 that i have the glib files i would need in my compilers directory. what would i change with my program to fix this?
10
3865
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 way to do it" that it's more efficient than read all the fields with the iterator, saves them on file and successively recreating the hash putting them once per time? Thanks in advice.
1
1789
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" function names in a file caleed glib.symbols. this file is used by a perl script to generate a header a .c file ( galias.h and galiasdefs.c). This files essentially enusres default visibility for these functions (using the __attribute__((default))__...
37
9063
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 across two projects that have the appeal of striving for simple, pythonic APIs: PyGUI and wax. The latter is a wrapper around wxPython. It is lacking documentation but actually quite usable and concise. The other, PyGUI, has an even nicer API and...
4
4636
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 number of elements and returns index of each element. How to avoid these warnings? warning: passing argument 1 of ‘g_list_nth’ from incompatible pointer type warning: format ‘%d’ expects type ‘int’, but argument 2 has type ‘struct GList *’
0
9706
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9579
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10577
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10320
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
7620
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6853
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5651
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3820
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2991
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.