On Mon, Jun 23, 2008 at 01:34:04PM +0200, Michael Kerrisk wrote:
> On Mon, Jun 23, 2008 at 1:31 PM, Stephane Chazelas
> <[EMAIL PROTECTED]> wrote:
> > On Mon, Jun 23, 2008 at 12:37:50PM +0200, Michael Kerrisk wrote:
> > [...]
> >>        This  feature  is not available if the program is compiled with
> >>        cc -std=cc99 or cc -D_ISOC99_SOURCE (unless _GNU_SOURCE is also
> > [...]
> >
> > typo: -std=c99, not cc99.
> 
> Thanks.  Fixed.  It sort of balanced out.  Elsewhere in the page I
> wrote another typo: -std=99.
[...]

With tcc, you need the -D_GNU_SOURCE:

~$ cat a.c
#include <stdio.h>
int main()
{
  char *a = 0;
  int n;
  n = sscanf("test", "%as", &a);
  printf("%d %s\n", n, a);
  return 0;
}
~$ tcc -run ./a.c
0 (null)
~$ tcc -D_GNU_SOURCE -run ./a.c
1 test

~$ tcc a.c
~$ nm -D a.out |& grep scanf
         U __isoc99_sscanf

~$ tcc -D_GNU_SOURCE a.c
~$ nm -D a.out |& grep scanf
         U sscanf

On debian, cc can be tcc.

~$ update-alternatives --list cc
/usr/bin/gcc
/usr/bin/tcc

-- 
Stéphane



--
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to