From wulf@cip.physik.uni-stuttgart.de Thu Dec 10 12:14:55 1992 Received: from calvin.sfasu.edu by umaxc.weeg.uiowa.edu (5.61.jnf/920629) on Thu, 10 Dec 92 12:14:52 -0600 id AA18856 with SMTP Received: from OSCAR.PHYSIK.UNI-STUTTGART.DE by calvin.sfasu.EDU with SMTP (5.59/25-eef) id AA13676; Thu, 10 Dec 92 12:06:55 CST Return-Path: Received: by cip.physik.uni-stuttgart.de (MX V3.1C) id 18073; Thu, 10 Dec 1992 18:57:42 +0100 Date: Thu, 10 Dec 1992 18:45:31 +0100 From: Wulf Hofbauer To: hyperc-l@calvin.sfasu.edu Message-Id: <00964E43.BB0F0EE0.18073@cip.physik.uni-stuttgart.de> Subject: '@' declaration in HyperC Status: R >>static char oa_key @0xc061; >>static char sa_key @0xc062; >You're right ... it's simple and it works too :-) >But I never heard of or seen that' @' operator used before. >Tell me about it. Ok, the "@" construct is a HyperC extension. It tells the compiler not to allocate room for a variable, but to store it at (or load it from) the address specified. Obviously, this variable will be non-dynamic and must therefore be either global or explicitly declared static. It is probably considered bad style to allocate variables manually. However this construct is very helpful for accessing I/O locations or accessing system variables. Ie, to access the ProDOS MACHID byte in the global page, you can declare it as BYTE machid @0xbf98; This can be a major time (and frustration) saver. The alternatives were to use pointers (produces only slightly less effective code, but requires weird-looking type casting) or to use external assembly routines (function calling overhead, must be linked). "Though this be madness, there is method in it." (Shakespeare) +-------------------------------------+-----------------------+ ! wulf@cip.physik.uni-stuttgart.de ! Apple // Enthusiast ! +-------------------------------------+-----------------------+ ! Wulf Hofbauer * Heilbronner Str. 12 * W-7146 Tamm * Germany ! ! Tel. 07141/602518 ! +-------------------------------------------------------------+