From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 4661 invoked by alias); 1 Feb 2003 17:33:51 -0000 Mailing-List: contact gdb-patches-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Received: (qmail 4654 invoked from network); 1 Feb 2003 17:33:50 -0000 Received: from unknown (HELO duracef.shout.net) (204.253.184.12) by 172.16.49.205 with SMTP; 1 Feb 2003 17:33:50 -0000 Received: (from mec@localhost) by duracef.shout.net (8.11.6/8.11.6) id h11HXne21013; Sat, 1 Feb 2003 11:33:49 -0600 Date: Sat, 01 Feb 2003 17:33:00 -0000 From: Michael Elizabeth Chastain Message-Id: <200302011733.h11HXne21013@duracef.shout.net> To: ac131313@redhat.com, msnyder@redhat.com Subject: Re: [patch/rfc] Eliminate char buf[MAX_REGISTER_RAW_SIZE] Cc: gdb-patches@sources.redhat.com X-SW-Source: 2003-02/txt/msg00028.txt.bz2 Michael Snyder writes: > Some compilers will not allow a function call in an auto initializer. I think you are thinking of static int i = foo (); /* not legal in any C standard that I know */ Rather than auto int i = foo (); /* been legal since K&R C */ Static and global initializers have to be resolved by link time so they have to be constants or nearly constant (address expressions like '&array' or '&function). Auto initializers can be any expression including function calls. It's been that way since K&R C. It would take a really deficient compiler to screw that up. I acknowledge that there is no limit to how messed up a vendor C compiler can actually be. So I took a quick look at utils.c (at random) to see if gdb uses this construct anywhere else. And it does: /* gdb 5.2.1 utils.c */ struct cleanup * make_cleanup_close (int fd) { int *saved_fd = xmalloc (sizeof (fd)); ... } void quit (void) { struct serial *gdb_stdout_serial = serial_fdopen (1); ... } So we are safe on this point. Michael C