Hallo Michael,

Du schriebst am Tue, 17 Dec 2013 09:33:34 +0100:

> Typecast is not only inlined but even builtin (in C source code it not 
> even looks like a function; this is PASCAL specific stuff.)

Sorry for stepping in, I promise I won't any more...

BUT: Does anybody _really_ think that type casting _does_ something?

A type cast, CPU wise, is a no-op, quite simply.
It is just a directive to the compiler that the programmer wants to do
something the language usually doesn't permit, i.e. interpret a variable of
one type as if it had another type. Often, this also includes size
conversion - but this is no real operation either, as this is done on the
fly by any common processor. Truncation simply means that part of the
value, i.e. part of a register's content, goes unused for the destination.
Expansion might even be disallowed altogether, or it might involve filling
the part missing in the source with zeroes. There's one special case,
though, that is when some compilers do sign extension on signed values,
which involves a processor instruction to the effect.

> abs() is a special beast, anyway...

What's so special about "abs"? Nothing at all. It's simply a comparison
used to decide whether to take the source value unchanged or "negate" it,
which usually is a single processor instruction. As pseudo code it would
look somewhat like:
        IF value < 0 THEN result:= -value ELSE result:= value;
Or in C:
        result= value < 0? -value: value;
Could be a preprocessor macro that way, even...

-- 
-- 
(Weitergabe von Adressdaten, Telefonnummern u.ä. ohne Zustimmung
nicht gestattet, ebenso Zusendung von Werbung oder ähnlichem)
-----------------------------------------------------------
Mit freundlichen Grüßen, S. Schicktanz
-----------------------------------------------------------



------------------------------------------------------------------------------
Rapidly troubleshoot problems before they affect your business. Most IT 
organizations don't have a clear picture of how application performance 
affects their revenue. With AppDynamics, you get 100% visibility into your 
Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro!
http://pubads.g.doubleclick.net/gampad/clk?id=84349831&iu=/4140/ostg.clktrk
_______________________________________________
mseide-msegui-talk mailing list
mseide-msegui-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk

Reply via email to