From owner-freebsd-hackers Sun Feb 22 12:26:15 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id MAA05190 for freebsd-hackers-outgoing; Sun, 22 Feb 1998 12:26:15 -0800 (PST) (envelope-from owner-freebsd-hackers@FreeBSD.ORG) Received: from mail.numachi.com (numachi.numachi.com [198.175.254.1]) by hub.freebsd.org (8.8.8/8.8.8) with SMTP id MAA05127 for ; Sun, 22 Feb 1998 12:25:06 -0800 (PST) (envelope-from reichert@numachi.numachi.COM) Received: (qmail 12495 invoked by uid 1001); 22 Feb 1998 20:25:03 -0000 Message-ID: <19980222152502.06434@numachi.com> Date: Sun, 22 Feb 1998 15:25:03 -0500 From: Brian Reichert To: hackers@FreeBSD.ORG Cc: stt@pluto.cpe.ku.ac.th Subject: Signal 11 problem Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 0.88 Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG Return-Path: Received: (qmail 12473 invoked by uid 1001); 22 Feb 1998 20:21:51 -0000 Message-ID: <19980222152150.11604@numachi.com> Date: Sun, 22 Feb 1998 15:21:50 -0500 From: Brian Reichert To: Sunthiti Patchararungruang Subject: Re: Signal 11 problem References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 0.88 In-Reply-To: ; from Sunthiti Patchararungruang on Mon, Feb 23, 1998 at 12:59:29AM +0700 Return-Receipt-To: reichert@numachi.com On Mon, Feb 23, 1998 at 12:59:29AM +0700, Sunthiti Patchararungruang wrote: > Dear Everybody, > > I have written a C program which has a function that need 10 > arguments. I cannot run this program because the signal-11 occured when I > call this function. > test (int, int, int, int, int, int, int, int, int, int, int) > main () > { > // Error Signal 11 I presume the C++ comment is a red herring. :) > test (a, b, c, d, e, f, g, h, i, j, k); > } [...] > main ( > { > test (a, b, c, d, e); > test (f, g, h, i, j); > test (a, b, k, d, e); > } Well, you declared the function as using ten arguments, then you only gave it five. How does your function 'know' that it's only been given five arguments? If it tries to make use an argument you didn't give it, it could easily leap off into nowhere... If you were to build your code with gcc -Wall, it would warn you about not handing in the right number of arguments... If you're trying to write a function that handles a variable number of arguments, look at stdarg(3). > Best Regards, > Sunthiti Patchararungruang -- Brian Reichert reichert@numachi.com Current daytime number: (617)-873-4337 37 Crystal Ave. #303 Derry NH 03038-1713 USA Intel architecture: the left-hand path To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message