From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 28871 invoked by alias); 18 Aug 2004 15:50:45 -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 28864 invoked from network); 18 Aug 2004 15:50:44 -0000 Received: from unknown (HELO nevyn.them.org) (66.93.172.17) by sourceware.org with SMTP; 18 Aug 2004 15:50:44 -0000 Received: from drow by nevyn.them.org with local (Exim 4.34 #1 (Debian)) id 1BxSi3-0004vu-F9; Wed, 18 Aug 2004 11:50:43 -0400 Date: Wed, 18 Aug 2004 15:50:00 -0000 From: Daniel Jacobowitz To: Michael Chastain Cc: gdb-patches@sources.redhat.com, baurzhan.ismagulov@sbs.com.tr Subject: Re: testcase for "absolute source" patch Message-ID: <20040818155042.GA18847@nevyn.them.org> Mail-Followup-To: Michael Chastain , gdb-patches@sources.redhat.com, baurzhan.ismagulov@sbs.com.tr References: <20040816144349.GB1509@ata.cs.hun.edu.tr> <412107B7.nailE7I1XJVIH@mindspring.com> <20040818130626.GB1411@ata.cs.hun.edu.tr> <4123763C.nailM3P11DT7E@mindspring.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4123763C.nailM3P11DT7E@mindspring.com> User-Agent: Mutt/1.5.5.1+cvs20040105i X-SW-Source: 2004-08/txt/msg00558.txt.bz2 On Wed, Aug 18, 2004 at 11:31:08AM -0400, Michael Chastain wrote: > Hi Baurzhan, > > bi> 1. Just for my knowledge: I've found the "int main" requirement in C99 > bi> 5.1.2.2.1. But I couldn't find anything about function definitions > bi> without a return type defaulting to int (i.e., should the compiler > bi> treat the return type as int if it isn't specified?). Does C99 and > bi> previous standards say anything about that? Is it different for > bi> declarations and definitions? > > I don't have copies of the standards documents, so I'm working from > The C++ Programming Language 2nd Edition, Kernighan and Ritchie. > To my surprise, I found out that in this book, and presumably in > the C89 standard, a function with no return type defaults to "int". > >From section 1.9: > > "This line also declares that getline returns an int; > since int is the default return type, it could be omitted." > > I don't think it's different for declarations and definitions. > > In a normal program, the FSF coding standards would apply. But a test > suite is contra-variant. Anything that is legal C89 and that doesn't > make gcc give a warning is okay in a test program, and variation is good > because it exercises different parts of gdb. > > So it's okay to leave your "main" with no return type. > But take out the "-w" from gdb_compile. Yes, C89 allows this, and C99 doesn't. -- Daniel Jacobowitz