Re: what is meant by ?

Tech-Archive recommends: Fix windows errors by optimizing your registry



In article <#YYLaNNQFHA.1176@xxxxxxxxxxxxxxxxxxxx>,
fhickman_NOSP@xxxxxxxxxxxxxxx says...

[ ... ]

> >> int j= (int)some_class_that_implements_the_int_cast_operator;
> >
> > Well - you surely did not want that C-style cast there, did you?

[ ... ]

> Sure I did, how else would the example have been written? Or would using
> static_cast have pleased you more? ;)

A cast operator supports implicit casts, so this could be written as:

int j = some_class_that_implements_the_int_cast_operator;

Proxy classes use this behavior heavily. Nicely enough, it "uses up"
the one implicit cast allowed on any particular item, so any other
conversion must be explicit.

--
Later,
Jerry.

The universe is a figment of its own imagination.
.



Relevant Pages

  • Re: how can i generate warnings for implicit casts that lose bits?
    ... C doesn't have implicit casts. ... the manual speaks of "explicit casts", then what is a cast that is not ... i still haven't heard the magic invocation i make to the gcc compiler ...
    (comp.dsp)
  • Re: help with statistics library
    ... explicit casts are preferable to implicit casts, ... Just a nitpick of your nitpick of his nitpick: a cast is an explicit ... conversion, so "implicit cast" is a contradiction in terms. ... I accept that my preference for this way of avoiding the cast might be ...
    (comp.programming)
  • Re: what is meant by ?
    ... >> A cast operator supports implicit casts, so this could be written as: ... I disagree - the cast just muddles things up. ...
    (microsoft.public.vc.language)
  • Re: Clarification on type punning.
    ... Type punning is both more AND less that what's done by a cast ... It's more than what's done by a cast operator, ... sufficient to convert a pointer of one type into a pointer of a ...
    (comp.lang.c)
  • Re: implicit cast operator funny-ness
    ... This is more a comment on the use of an implicit cast operator to ... perform this conversion. ... describes some weirdness with regards to the implicit casting operator. ...
    (microsoft.public.dotnet.languages.csharp)