beard@ux1.lbl.gov (Patrick C Beard) (01/13/90)
In article <9623@hoptoad.uucp> tim@hoptoad.uucp (Tim Maroney) writes:
#
#To access low-memory globals from C, if you must, you use the macro
#preprocessor. For instance, you would say
#
##define CurrentA5 (*(long *)0x904)
A cleaner way to do low memory globals from THINK C is the ':' notation.
extern Ptr CurrentA5 : 0x904;
This method gives you do type checking if you want.
-------------------------------------------------------------------------------
- Patrick Beard, Macintosh Programmer (beard@lbl.gov) -
- Berkeley Systems, Inc. ".......<dead air>.......Good day!" - Paul Harvey -
-------------------------------------------------------------------------------
tim@hoptoad.uucp (Tim Maroney) (01/14/90)
In article <9623@hoptoad.uucp> tim@hoptoad.uucp (Tim Maroney) writes: >#To access low-memory globals from C, if you must, you use the macro >#preprocessor. For instance, you would say ># >##define CurrentA5 (*(long *)0x904) In article <4615@helios.ee.lbl.gov> beard@ux1.lbl.gov (Patrick C Beard) writes: >A cleaner way to do low memory globals from THINK C is the ':' notation. > >extern Ptr CurrentA5 : 0x904; > >This method gives you do type checking if you want. So do the macros; the expression has a type. I don't think it's "clean" to add new language features when existing ones will do just as well. -- Tim Maroney, Mac Software Consultant, sun!hoptoad!tim, tim@toad.com "Every year, thousands of new Randoids join the ranks. Most tend to be either too-rich self-made tycoons or picked-on computer nerds (the romantic, heroic individualism of Rand's novels flatters the former and fuels the latter's revenge fantasies)." -- Bob Mack, SPY, July 1989
siegel@endor.harvard.edu (Rich Siegel) (01/15/90)
In article <9672@hoptoad.uucp> tim@hoptoad.UUCP (Tim Maroney) writes: > >So do the macros; the expression has a type. I don't think it's "clean" >to add new language features when existing ones will do just as well. >Tim Maroney, Mac Software Consultant, sun!hoptoad!tim, tim@toad.com Then how would you justify the existence of C++??? :-) :-) :-) R. ~~~~~~~~~~~~~~~ Rich Siegel Staff Software Developer Symantec Corporation, Language Products Group Internet: siegel@endor.harvard.edu UUCP: ..harvard!endor!siegel "When someone who makes four hundred and fifty dollars an hour wants to tell you something for free, it's a good idea to listen." ~~~~~~~~~~~~~~~
zben@umd5.umd.edu (Ben Cranston) (01/16/90)
In article <9623@hoptoad.uucp> tim@hoptoad.uucp (Tim Maroney) writes: > To access low-memory globals from C, if you must, you use the macro > preprocessor. For instance, you would say > #define CurrentA5 (*(long *)0x904) In article <4615@helios.ee.lbl.gov> beard@ux1.lbl.gov (Patrick C Beard) writes: > A cleaner way to do low memory globals from THINK C is the ':' notation. > extern Ptr CurrentA5 : 0x904; > This method gives you do type checking if you want. While the ':' notation is very clean and would be nice to have in MPW someday, can anybody see a reason why the equates in the various *.h files could not simply be in C access format: in frump.h: #define FrumpCount *(short *) 0x1234; in user code #include <frump.h> FrumpCount = 0; /* fudge system global */ as it stands now, the equates are just to the numbers and the user program must supply the cast: in frump.h: #define FrumpCount 0x1234; in user code #include <frump.h> *(short * FrumpCount) = 0; In other words, can anybody see a profitable use for the address as a plain integer rather than a cast item? Actually, one could probably recover the integer for most purposes simply by using the &FrumpCount construct... (except for compile time values with stupid compilers). Is there any reason for using the simple number equates other than a bad case of assembly language hangover? (utmost apologies to whatever actually lives at 0x1234...) -- Sig DS.L ('ZBen') ; Ben Cranston <zben@Trantor.UMD.EDU> * Network Infrastructures Group, Computer Science Center * University of Maryland at College Park * of Ulm
kaufman@Neon.Stanford.EDU (Marc T. Kaufman) (01/17/90)
In article <1248@husc6.harvard.edu> siegel@endor.UUCP (Rich Siegel) writes: >In article <9672@hoptoad.uucp> tim@hoptoad.UUCP (Tim Maroney) writes: -> I don't think it's "clean" ->to add new language features when existing ones will do just as well. ->Tim Maroney, Mac Software Consultant, sun!hoptoad!tim, tim@toad.com > Then how would you justify the existence of C++??? :-) :-) :-) >R. That's a loaded question. *I* certainly can't justify the existence of C++. After all, Simula, in 1967, had most of the class hierarchy and LIGHTWEIGHT PROCESSES TOO! I think I'll wait for an Object Oriented language that has the capability of simultaneous execution of several objects ( C+++? ). Single thread execution goes against the object abstraction. Marc Kaufman (kaufman@Neon.stanford.edu)