[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Tinycc-devel] 0.9.22 - Function name in conditional expression?

From: Charles Randall
Subject: [Tinycc-devel] 0.9.22 - Function name in conditional expression?
Date: Wed, 10 Nov 2004 23:11:35 -0800 (PST)

Both gcc 3.2.2 and splint think that the code
appended below is ANSI C (E.g., 'gcc -Wall -ansi
-pedantic' gives no errors).

First, is this standard C construct?

Second, if so, tcc reports,

% tcc cond-expr-func.c
cond-expr-func.c:21: function pointer expected

Is this a bug?

This is used in a lot of GNU sources.


--- cond-expr-func.c ---
#include <stdlib.h>

static int a(int x)
  return x;

static int b(int x)
  return 2*x;

int main(void)
  int i = 7;
  int x = 1;
  int y, ai, bi;
  ai = a(i);
  bi = b(i);
  y = (x == 0 ? a : b) (i);
  assert(y == bi);
  return EXIT_SUCCESS;

reply via email to

[Prev in Thread] Current Thread [Next in Thread]