From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 22424 invoked by alias); 8 Oct 2005 02:25:30 -0000 Mailing-List: contact gcc-help-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-help-owner@gcc.gnu.org Received: (qmail 22279 invoked by uid 22791); 8 Oct 2005 02:25:24 -0000 Received: from eastrmmtao05.cox.net (HELO eastrmmtao05.cox.net) (68.230.240.34) by sourceware.org (qpsmtpd/0.30-dev) with ESMTP; Sat, 08 Oct 2005 02:25:24 +0000 Received: from white ([68.9.64.121]) by eastrmmtao05.cox.net (InterMail vM.6.01.05.02 201-2131-123-102-20050715) with ESMTP id <20051008022520.YRQN28234.eastrmmtao05.cox.net@white>; Fri, 7 Oct 2005 22:25:20 -0400 Received: from bob by white with local (Exim 3.36 #1 (Debian)) id 1EO4Oi-0003cQ-00; Fri, 07 Oct 2005 22:25:16 -0400 Date: Sat, 08 Oct 2005 02:25:00 -0000 From: Bob Rossi To: Pedro Henrique Cc: gcc-help@gcc.gnu.org Subject: Re: Function Pointer to main() Message-ID: <20051008022516.GA13902@white> Mail-Followup-To: Pedro Henrique , gcc-help@gcc.gnu.org References: <4346FE58.8010004@yahoo.com.br> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4346FE58.8010004@yahoo.com.br> User-Agent: Mutt/1.5.9i X-SW-Source: 2005-10/txt/msg00041.txt.bz2 On Fri, Oct 07, 2005 at 08:01:44PM -0300, Pedro Henrique wrote: > Hi Everyone, > > I was playing with my compiler and so I tried this: > > int main (){ > int (*p_func)() = main; > p_func(); > } > > I was trying to perceive more about the details of main function. Could > someone explain me what the program tries to do? Why > doesn't the program begin a infinite recursion? It does go into an infinate loop. Use GDB to follow the execution. BTW, that program locked up my machine for a good minute until it died. Bob Rossi