Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!romp!auschs!d75!awdprime!ziggy.austin.ibm.com!ehill From: ehill@ziggy.austin.ibm.com Newsgroups: comp.lang.pascal Subject: Re: Untyped Parameters Message-ID: <5725@awdprime.UUCP> Date: 4 Mar 91 16:20:07 GMT References: <1991Mar4.043821.4742@cs.mcgill.ca> Sender: news@awdprime.UUCP Followup-To: Article 3339 Organization: IBM Personal Systems Programming Center, Austin Lines: 37 In article <1991Mar4.043821.4742@cs.mcgill.ca> storm@cs.mcgill.ca (Marc WANDSCHNEIDER) writes: [Some text deleted..] > > Function DectoHex (i:Word): St4; {st4 is string[4] declared already} > var HexStr: string[8]; > b : array[1..2] of BYTE ABSOLUTE i; > bt: byte; > begin > etc... > >i has already been declared as a typed variable. How is it that it is >being used here as an UNTYPED variable..? > >Any help on this would dearly help my already overloaded brain. > >~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ [Remainder deleted..] REPLY: This is just another form of type casting. In the case above, the programmer wanted to treat the WORD variable as an array of two bytes. Since a WORD is two bytes this allows the programmer to manipulate each byte independently. The method may be used on both typed and untyped variables. There are dangers in this type of casting. If you don't use a variable of equal or less storage place, you run the risk of wiping out some valuable data. SO, PROGRAMMER BEWARE!!! Hope that helps, Ed Hill internet: ehill@wombat.austin.ibm.com ---------------------------------------------------------------------------- DISCLAIMER: The comments above are solely those of the writer, not IBM. ----------------------------------------------------------------------------