RE: (off-topic) RE: [Doxygen-users] Documenting IDL
Brought to you by:
dimitri
From: Victor A. W. Jr. <va...@ru...> - 2001-06-08 12:37:05
|
I'll try to answer best I can...... replies in the text At Friday 2001/06/08 06:53, you wrote: >[Just found this sitting unsent in my outbox and its still an interesting C++ >issue, so:] > > > -----Original Message----- > > From: dox...@li... > > [mailto:dox...@li...]On Behalf Of Wagner, > > Victor > > Sent: 08 May 2001 14:16 > > To: 'dox...@li...' > > Subject: RE: (off-topic) RE: [Doxygen-users] Documenting IDL > > > > > > I didn't say operator int(), I said operator void* (). There > > is a large > > difference. > >When starting this, I deliberately avoided addined an operator that could be >mistakenly read as returning more information than it does - something that >returns 'bool' is unambiguous, even the most neophyte "next new guy to >join the >team" isn't going to try and cast it to anything (which sounds a bit rude and >snotty, but it is exactly the sort of thing that has happened). > >So far as any other code is concerned, _what_ is this large difference? >The only >use for this operator is in a test such as "if (ptr)" and bool seems to >fit that >idea quite nicely. But it isn't really a bool. If you write operator bool() then it could be used anywhere a bool is valid (not just in if and while). I'm just following several authors dictum (when in doubt, do what the built in types do...in this case, I consider the STL 'built in') > > the problem of 'adding' your own test is that it isn't the same as: > > real pointers > >Very true - for example, with 'real pointers' I wouldn't get upset if people >wrote all their functions calls as Fum(MyPointer fred) whereas with >ref-counted >pointers, for example, you want to write Fum(const MyPointer& fred). These are >not 'real pointers' and sometimes it is good to be reminded of this (and >sometimes it is bad). > > > STL iterators > >Well, I admit to not having tried to combine the two (remember, this all >started >from old code, VC++2 days, which rather pre-dates a (working) copy of STL >being >available). If (when?) it becomes necessary to combine the two, that does not >preclude leaving in 'IsValid()' - after all, to be an iterator you just >need to >provide the correct interface and after that you can add anything else you >want. > >One day, no doubt, the two will coincide, when someone wants to feed one of >these pointers to an STL algorithm, at which time it would be useful to know >what the large difference is between using operator bool() and operator void >*() - does the former stop something working? > >Regards, >Stephen Goudge Victor A. Wagner, Jr. PGP RSA fingerprint = 4D20 EBF6 0101 B069 3817 8DBF C846 E47A PGP D-H fingerprint = 98BC 65E3 1A19 43EC 3908 65B9 F755 E6F4 63BB 9D93 The five most dangerous words in the English language: "There oughta be a law" |