home *** CD-ROM | disk | FTP | other *** search
- Path: cs.uwa.edu.au!jasonb
- From: jasonb@cs.uwa.edu.au (Jason S Birch)
- Newsgroups: comp.sys.amiga.programmer
- Subject: Re: PPC compilers
- Date: 10 Jan 96 04:24:30 GMT
- Organization: The University of Western Australia
- Message-ID: <jasonb.821247870@cs.uwa.edu.au>
- References: <john.hendrikx.40ka@grafix.xs4all.nl> <MQAQx*XOe@yaps.rhein.de> <OWhVx*42f@yaps.rhein.de> <4cuhng$dmn@maureen.teleport.com>
- NNTP-Posting-Host: decadence.cs.uwa.oz.au
- X-Newsreader: NN version 6.5.0 #3 (NOV)
-
- sschaem@teleport.com (Stephan Schaem) writes:
- >Arno Eigenwillig (arno@yaps.rhein.de) wrote:
- >: Why don't you read what he wrote? A reasonable example for that would
- >: be operations on clock_t.
-
- > The claim was general: you can forget your variable type when you use
- > them in C... I'm just saying thats its not wise.
-
- What we've been (repeatedly) trying to say, is that's *not* what he
- said. He said you can forget about the *implementation* of your
- variable type on a particular machine (if the data is encapsulated
- correctly). The whole point being that in assembler, you cannot forget
- the implementation, because pratically every time you do *use* a
- "variable" of that type, you have to specify how big it is.
-
- >: Why don't you read what he wrote? You use clock_t and treat it as a
- >: 'black box'. As you never name the underlying type, you are fully
- >: portable.
-
- > What if clock_t is on other system a pointer to a bcpl string?
-
- Unfortunately that will not work, because clock_t isn't sufficiently
- encapsulated - ie. to find the difference between two clock_t values,
- you must use "-", and "-" acts as expected only on ordinal types. With
- C++, however, "-" can be overloaded to work with *any* definition of
- clock_t, including BCPL strings.
-
- For a better example, look at time_t. It comes with a full suite of
- support functions that effectively hide its implementation from you.
- So it could well be implemented as a BCPL string right now without
- causing any problems (at least for programmers who don't see it's eg.
- a long and try to use "-" to find differences in time instead of
- difftime()).
-
- >: Name an existing assembler that allows such things.
-
- > You can write yourself a simple preprocessor that will do a search replace
- > using a mytype.typedef file... The point I wanted to make is this:
- > [Store variable of type A, into variable of type A]
- > This is what I think when I write
- > chipreg->bltcon0 = con0;
- > [Store con0 of type CHIPREG, into chipreg.bltcon0 of type CHIPREG]
- > &
- > move.w (GLOBAL_con0_w,a4),(CHIPREG_bltcon0_w,a1)
- > [Store con0 of type WORD, into chipreg.bltcon0 of type WORD]
- > here I just happen to know WORD is 2 byte.. but so what.
-
- Again, the "so what" is that in assembler, you're using the knowledge
- that CHIPREG is a WORD - as soon as you do that, you've tied yourself
- to only one implementation of CHIPREG.
-
- > Stephan
-
- --
- Jason S Birch ,-_|\ email: jasonb@cs.uwa.edu.au
- Department of Computer Science / \ Tel (work): +61 9 380 1840
- The University of Western Australia *_.-._/ Fax (work): +61 9 380 1089
- Nedlands W. Australia 6907 v Tel (home): +61 9 386 8630
-