From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 23994 invoked by alias); 9 Dec 2003 20:40:36 -0000 Mailing-List: contact gcc-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-owner@gcc.gnu.org Received: (qmail 23975 invoked from network); 9 Dec 2003 20:40:35 -0000 Received: from unknown (HELO smtp10.atl.mindspring.net) (207.69.200.246) by sources.redhat.com with SMTP; 9 Dec 2003 20:40:35 -0000 Received: from user-119a90a.biz.mindspring.com ([66.149.36.10] helo=berman.michael-chastain.com) by smtp10.atl.mindspring.net with esmtp (Exim 3.33 #1) id 1AToeo-0001gj-00 for gcc@gcc.gnu.org; Tue, 09 Dec 2003 15:40:34 -0500 Received: by berman.michael-chastain.com (Postfix, from userid 502) id 906D84B412; Tue, 9 Dec 2003 15:40:37 -0500 (EST) To: gcc@gcc.gnu.org Subject: (printf) ("hello world\n"); Message-Id: <20031209204037.906D84B412@berman.michael-chastain.com> Date: Tue, 09 Dec 2003 20:41:00 -0000 From: mec.gnu@mindspring.com (Michael Elizabeth Chastain) X-SW-Source: 2003-12/txt/msg00594.txt.bz2 I have a language lawyer question. int main () { (printf) ("hello world\n"); return 0; } Is this a conforming C program? There is no "#include " so there is no declaration in scope for printf. gcc 2.95.3 and gcc 3.3.2 both say: hello.c: In function `main': hello.c:3: `printf' undeclared (first use in this function) hello.c:3: (Each undeclared identifier is reported only once hello.c:3: for each function it appears in.) This happens with each of: -std=iso9899:1990 -std=iso9899:199409 -std=iso9899:1999 But the HP ansi-c and aCC compilers accept it just fine. This kind of code comes out of a macro expansion with readline 4.3 and gcc 3.3.2 on native hppa2.0w-hp-hpux11.11. It's the end result of an interaction between multibyte support in hpux11 and a strange-looking workaround in readline. Of course the question "is this conforming ..." depends on a particular standard. So I think I am asking three questions, one for each of the three standards. If the program is not conforming, then I can work on a patch for readline. But if the program is conforming, then I can file a PR against gcc (and I'll still have to patch readline). (Personally I would be happier if this program is not conforming.) Michael C