Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!samsung!aplcen!unmvax!nmtsun!jrwsnsr From: jrwsnsr@nmtsun.nmt.edu (Jonathan R. Watts) Newsgroups: comp.lang.pascal Subject: Re: TP bug??? Message-ID: <3659@nmtsun.nmt.edu> Date: 14 Dec 89 02:36:48 GMT References: Distribution: comp Organization: New Mexico Tech, Socorro NM Lines: 53 In article , ron@clarity.Princeton.EDU (Ronald Beekelaar) writes: > >I was trying to compile the following TP code, but everytime the compiler hang >and even ctrl-break didn't work anymore. I had to reboot the computer. > >The following code is not the actually code. I just typed this as an example >of what the code looked like, that I tried to compile. I am using TP 5.0. > >------------- >Unit mycolor; > >Uses Crt; > >Interface > >Function color(fore, back: byte): byte; > > > >Implementation > >Const stringcolor: byte = color(blue, red); > >Function color(fore, back: byte): byte; > begin > color:= (fore and $8F) + (back and $70) > end; > > >End. I'm not surprised it's hanging on you! You can only refer to certain BUILT-IN functions in constant declarations, not your own functions! The way your code is written, it's trying to use your "color" function before the function has been compiled! (Although I am surprised the compiler didn't catch this and give you an error.) A much better way to do it is: ... Implementation var stringcolor : byte; function color... begin stringcolor := color(blue, red); end. - Jonathan Watts jrwsnsr@jupiter.nmt.edu