64 bit Fedora 9's gcc regards this as an error, all the other gcc's eg
on 32 bit Fedora Core 3 have no problem with this.
I use this a lot in order to pass var args to another function.
eg I have recursive functions which take variable numbers of args
and redirect to user supplied functions to process those args.
for porting code I dont want to have to rewrite everything,
also the gcc gives endless signedness warnings because my
code uses
unsigned char *
instead of
char *
for strings, I do that because I need to guarantee that chars are unsigned,
in order to avoid the ambiguity of EOF versus 255.
--
fedora-list mailing list
fedora-list@redhat.com
To unsubscribe: https://www.redhat.com/mailman/listinfo/fedora-list
08-01-2008, 02:00 AM
Tom Horsley
gcc varargs problem
On Fri, 01 Aug 2008 02:36:54 +0100
whoosh <whoosh777@blueyonder.co.uk> wrote:
> 64 bit Fedora 9's gcc regards this as an error, all the other gcc's eg
> on 32 bit Fedora Core 3 have no problem with this.
The standard regards it as an error as well, and if you looked up
the insane argument passing conventions for x86_64, you'd know why :-).
If you want to write portable code, look at the stdarg man page and
use the va_start, va_copy, etc. macros.
--
fedora-list mailing list
fedora-list@redhat.com
To unsubscribe: https://www.redhat.com/mailman/listinfo/fedora-list
08-01-2008, 02:14 AM
whoosh
gcc varargs problem
On 01-Aug-08 03:00:09 Tom Horsley wrote:
>On Fri, 01 Aug 2008 02:36:54 +0100
>whoosh <whoosh777@blueyonder.co.uk> wrote:
>> 64 bit Fedora 9's gcc regards this as an error, all the other gcc's eg
>> on 32 bit Fedora Core 3 have no problem with this.
>The standard regards it as an error as well, and if you looked up
>the insane argument passing conventions for x86_64, you'd know why :-).
>If you want to write portable code, look at the stdarg man page and
>use the va_start, va_copy, etc. macros.
ok, from that man page it looks like the way to do it is:
is there a way to switch off the signedness errors, where
I use "unsigned char *" for strings to prevent char 255 being
sign extended to EOF?
>--
>fedora-list mailing list
>fedora-list@redhat.com
>To unsubscribe: https://www.redhat.com/mailman/listinfo/fedora-list
--
fedora-list mailing list
fedora-list@redhat.com
To unsubscribe: https://www.redhat.com/mailman/listinfo/fedora-list
08-01-2008, 02:22 AM
Kevin Kofler
gcc varargs problem
whoosh <whoosh777 <at> blueyonder.co.uk> writes:
> is there a way to switch off the signedness errors, where
-Wno-pointer-sign
Kevin Kofler
--
fedora-list mailing list
fedora-list@redhat.com
To unsubscribe: https://www.redhat.com/mailman/listinfo/fedora-list
08-01-2008, 02:22 AM
Sam Varshavchik
gcc varargs problem
whoosh writes:
On 01-Aug-08 03:00:09 Tom Horsley wrote:
On Fri, 01 Aug 2008 02:36:54 +0100
whoosh <whoosh777@blueyonder.co.uk> wrote:
64 bit Fedora 9's gcc regards this as an error, all the other gcc's eg
on 32 bit Fedora Core 3 have no problem with this.
The standard regards it as an error as well, and if you looked up
the insane argument passing conventions for x86_64, you'd know why :-).
If you want to write portable code, look at the stdarg man page and
use the va_start, va_copy, etc. macros.
ok, from that man page it looks like the way to do it is:
f( va_list *pargs )
No, that's not what that man page states. See the EXAMPLE section.
is there a way to switch off the signedness errors, where
I use "unsigned char *" for strings to prevent char 255 being
sign extended to EOF?
Use explicit casts.
--
fedora-list mailing list
fedora-list@redhat.com
To unsubscribe: https://www.redhat.com/mailman/listinfo/fedora-list
08-01-2008, 02:00 PM
"Steven W. Orr"
gcc varargs problem
On Thursday, Jul 31st 2008 at 21:36 -0000, quoth whoosh:
=>
=>all gcc's so far have accepted the following code,
=>
=>until now using gcc on Fedora 9:
=>
=>
=>void f( va_list *pargs )
=>{
=>va_list args = *pargs ;
=>...
=>}
=>
=>64 bit Fedora 9's gcc regards this as an error, all the other gcc's eg
=>on 32 bit Fedora Core 3 have no problem with this.
=>
=>
=>I use this a lot in order to pass var args to another function.
=>eg I have recursive functions which take variable numbers of args
=>and redirect to user supplied functions to process those args.
=>
=>
=>for porting code I dont want to have to rewrite everything,
=>
=>
=>also the gcc gives endless signedness warnings because my
=>code uses
=>
=>unsigned char *
=>
=>instead of
=>
=>char *
=>
=>for strings, I do that because I need to guarantee that chars are unsigned,
=>
=>in order to avoid the ambiguity of EOF versus 255.
Do not use varargs. Use stdargs. Convert any code that uses varargs to use
stdargs. See man 3 stdarg.
--
Time flies like the wind. Fruit flies like a banana. Stranger things have .0.
happened but none stranger than this. Does your driver's license say Organ ..0
Donor?Black holes are where God divided by zero. Listen to me! We are all- 000
individuals! What if this weren't a hypothetical question?
steveo at syslang.net
--
fedora-list mailing list
fedora-list@redhat.com
To unsubscribe: https://www.redhat.com/mailman/listinfo/fedora-list
08-01-2008, 04:36 PM
Bill Davidsen
gcc varargs problem
whoosh wrote:
all gcc's so far have accepted the following code,
64 bit Fedora 9's gcc regards this as an error, all the other gcc's eg
on 32 bit Fedora Core 3 have no problem with this.
I use this a lot in order to pass var args to another function.
eg I have recursive functions which take variable numbers of args
and redirect to user supplied functions to process those args.
for porting code I dont want to have to rewrite everything,
Yes, that is an issue, and even using the compatibility RPMs the new
includes seem to be used and old code doesn't compile properly. I have
set up a virtual machine using an old version (RH9 or FC1) so I can
compile what I need and link static so I can use the code I need.
--
Bill Davidsen <davidsen@tmr.com>
"We have more to fear from the bungling of the incompetent than from
the machinations of the wicked." - from Slashdot
--
fedora-list mailing list
fedora-list@redhat.com
To unsubscribe: https://www.redhat.com/mailman/listinfo/fedora-list
08-01-2008, 08:54 PM
whoosh
gcc varargs problem
On 01-Aug-08 03:22:26 Kevin Kofler wrote:
>whoosh <whoosh777 <at> blueyonder.co.uk> writes:
>> is there a way to switch off the signedness errors, where
>-Wno-pointer-sign
> Kevin Kofler
excellent, I had given up!
>--
>fedora-list mailing list
>fedora-list@redhat.com
>To unsubscribe: https://www.redhat.com/mailman/listinfo/fedora-list
--
fedora-list mailing list
fedora-list@redhat.com
To unsubscribe: https://www.redhat.com/mailman/listinfo/fedora-list
08-01-2008, 09:09 PM
whoosh
gcc varargs problem
On 01-Aug-08 03:22:56 Sam Varshavchik wrote:
>whoosh writes:
>> On 01-Aug-08 03:00:09 Tom Horsley wrote:
>>>On Fri, 01 Aug 2008 02:36:54 +0100
>>>whoosh <whoosh777@blueyonder.co.uk> wrote:
>>
>>>> 64 bit Fedora 9's gcc regards this as an error, all the other gcc's eg
>>>> on 32 bit Fedora Core 3 have no problem with this.
>>
>>>The standard regards it as an error as well, and if you looked up
>>>the insane argument passing conventions for x86_64, you'd know why :-).
>>>If you want to write portable code, look at the stdarg man page and
>>>use the va_start, va_copy, etc. macros.
>>
>>
>> ok, from that man page it looks like the way to do it is:
>>
>> f( va_list *pargs )
>No, that's not what that man page states. See the EXAMPLE section.
>> is there a way to switch off the signedness errors, where
>>
>> I use "unsigned char *" for strings to prevent char 255 being
>>
>> sign extended to EOF?
>Use explicit casts.
too much work,
this is stable code which I have been using for probably 2 years,
-Wall with earlier gcc's no errors at all, thus I need a backward
compatibility option,
once code has stabilised I dont like changing it unless it is a
GENUINE problem.
for dealing with files, strings are BETTER as "unsigned char *"
than as "char *" as EOF is typically -1, DIFFERENT from the valid char 255
someone on the list has suggested -Wno-pointer-sign
--
fedora-list mailing list
fedora-list@redhat.com
To unsubscribe: https://www.redhat.com/mailman/listinfo/fedora-list
08-01-2008, 09:37 PM
whoosh
gcc varargs problem
On 01-Aug-08 15:00:59 Steven W. Orr wrote:
>On Thursday, Jul 31st 2008 at 21:36 -0000, quoth whoosh:
>=>
>=>all gcc's so far have accepted the following code,
>=>
>=>until now using gcc on Fedora 9:
>=>
>=>
>=>void f( va_list *pargs )
>=>{
>=>va_list args = *pargs ;
>=>...
>=>}
>=>
>=>64 bit Fedora 9's gcc regards this as an error, all the other gcc's eg
>=>on 32 bit Fedora Core 3 have no problem with this.
>=>
>=>
>=>I use this a lot in order to pass var args to another function.
>=>eg I have recursive functions which take variable numbers of args
>=>and redirect to user supplied functions to process those args.
>=>
>=>
>=>for porting code I dont want to have to rewrite everything,
>=>
>=>
>=>also the gcc gives endless signedness warnings because my
>=>code uses
>=>
>=>unsigned char *
>=>
>=>instead of
>=>
>=>char *
>=>
>=>for strings, I do that because I need to guarantee that chars are unsigned,
>=>
>=>in order to avoid the ambiguity of EOF versus 255.
>Do not use varargs. Use stdargs. Convert any code that uses varargs to use
>stdargs. See man 3 stdarg.
I have changed it to:
va_list args ;
va_copy( args, *pargs ) ;
which compiles and functions correctly.
However earlier gcc's DONT recognise va_copy(), thus I need
note that when I do "args = *pargs ; " I am merely assuming that
"args" is a pointer, thus "args = *pargs ; " is fine,
its only a problem if args is an aggregate.
typedef struct anything_at_all *va_list ;
f( va_list *pargs )
{
va_list args = *pargs ;
}
is completely fine provided va_list is a pointer.
>--
>Time flies like the wind. Fruit flies like a banana. Stranger things have
.0.
>happened but none stranger than this. Does your driver's license say Organ
..0
>Donor?
>Black holes are where God divided by zero.
thats the best explanation I have heard!
> Listen to me! We are all- 000
>individuals! What if this weren't a hypothetical question?
>steveo at syslang.net
--
fedora-list mailing list
fedora-list@redhat.com
To unsubscribe: https://www.redhat.com/mailman/listinfo/fedora-list