Return to BSD News archive
Xref: sserve comp.lang.c:36979 comp.unix.bsd:9127 Path: sserve!manuel.anu.edu.au!munnari.oz.au!spool.mu.edu!uunet!mcsun!julienas!seti!minos!canalda From: canalda@minos.inria.fr Newsgroups: comp.lang.c,comp.unix.bsd Subject: Re: Segmentation faults Message-ID: <4749@seti.inria.fr> Date: 18 Dec 92 15:23:17 GMT References: <1gricmINNsl@ub.d.umn.edu> Sender: news@seti.inria.fr Reply-To: canalda@minos.inria.fr Followup-To: comp.lang.c Organization: Institut National de Recherche en Informatique et Automatique (INRIA) Lines: 50 Hi, In order to answer to the 37231th article in comp.lang.c group, I rewrite some part of the initial article. >void end() >{ > printf("\33[?25h"); /*BTW what does this do with an ANSI terminal?*/ >} > >int main() >{ /*This code is for testing the above for use with terminals*/ > char s[80]; > int x,y; > start1(); > start2(); > do{ > writexy(1,1,"enter x y string:"); > scanf("%d%d%s",&x,&y,s); > writexy(x,y,s); > } while(s[0]!='#'); > end(); > return 0; >} In this program the declaration of end() is ambiguous because it also refers to standard routines : extern end; This name refers neither to routines nor to locations with interesting contents. The address of end() is the first address above the uninitialized data region. When execution begins, the program break (the first location beyond the data) coincides with end, but it is reset by the routines brk, malloc, standard input/output and so on. So a simple solution would be to change the name of your eeeeeennnnnnnnnddddddd. Good receive. ######################################################################### # _______ __ ______ email : canalda@minos.inria.fr# # /______ /| /_ /| /_____ /| address: I.N.R.I.A. # #| __ | || | |___ | ___|/ Dommaine de Voluceau # #| |/_) | || |/___ /| | | | Rocquencourt B.P.105 # #| ____|/ | __ | | __ | | |___ __ 78153 LeChesnayCedex # #| | | | | || | | /_ /|| |/__ /| /_ /| FRANCE # #|__|/ |__|/ |_|/ |__|/ |______|/ |__|/ tel: +33 (1) 39 63 53 61 # #########################################################################