Re: [MSEide-MSEgui-talk] MSElang, implicit type conversions
On 12/16/2013 03:58 PM, Martin Schreiber wrote: unsigned:= card32(abs(signed)); This suggests that the result of abs is signed and need an explicit conversion to unsigned. I'm not sure that this is beneficial. OTHO what is abs anyway ? Is it some kind of builtin overloaded function that works differently for different argument types ? What is the type of the result ? -Michael -- 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=84349831iu=/4140/ostg.clktrk ___ mseide-msegui-talk mailing list mseide-msegui-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk
Re: [MSEide-MSEgui-talk] MSElang, implicit type conversions
On 12/16/2013 04:44 PM, Ivanko B wrote: Then typecasts ABS should be inline-d. Typecast is not only inlined but even builtin (in C source code it not even looks like a function; this is PASCAL specific stuff.) abs() is a special beast, anyway... -Michael -- 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=84349831iu=/4140/ostg.clktrk ___ mseide-msegui-talk mailing list mseide-msegui-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk
Re: [MSEide-MSEgui-talk] MSElang, implicit type conversions
On 12/17/2013 09:30 AM, Michael Schnell wrote: OTHO what is abs anyway ? Is it some kind of builtin overloaded function that works differently for different argument types ? BTW.: Funny stuff: Is the argument of abs() would be fixed to signed, and we would have automatic type conversion what would be the result of this code ? var i : card32; i := 4294967295; i := abs(i); IMHO i needs to be 1. - 4294967295 = $ - $ in signed is -1 - abs of -1 is 1 -Michael -- 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=84349831iu=/4140/ostg.clktrk ___ mseide-msegui-talk mailing list mseide-msegui-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk
Re: [MSEide-MSEgui-talk] MSElang, implicit type conversions
On Tuesday 17 December 2013 09:30:52 Michael Schnell wrote: On 12/16/2013 03:58 PM, Martin Schreiber wrote: unsigned:= card32(abs(signed)); This suggests that the result of abs is signed and need an explicit conversion to unsigned. Correct. There is no abs() for unsigned types. I'm not sure that this is beneficial. OTHO what is abs anyway ? Is it some kind of builtin overloaded function that works differently for different argument types ? Yes, as in Free Pascal: http://www.freepascal.org/docs-html/rtl/system/abs.html What is the type of the result ? The type of the input parameter. Martin -- 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=84349831iu=/4140/ostg.clktrk ___ mseide-msegui-talk mailing list mseide-msegui-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk
Re: [MSEide-MSEgui-talk] MSElang, implicit type conversions
Correct. There is no abs() for unsigned types == Do You want to disable these (100% compatible) types as arguments ? Looks a bit revolutionary :) -- 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=84349831iu=/4140/ostg.clktrk ___ mseide-msegui-talk mailing list mseide-msegui-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk
Re: [MSEide-MSEgui-talk] MSElang, implicit type conversions
On Tuesday 17 December 2013 18:38:39 Ivanko B wrote: Correct. There is no abs() for unsigned types == Do You want to disable these (100% compatible) types as arguments ? Looks a bit revolutionary :) One can always use explicit type conversions. MSElang principle is to make *no* implicit type conversions. For abs() use integervar:= abs(integer(cardinalvalue)); Martin -- 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=84349831iu=/4140/ostg.clktrk ___ mseide-msegui-talk mailing list mseide-msegui-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk
Re: [MSEide-MSEgui-talk] MSElang, implicit type conversions
This may be considered as a joke by non-devoted people :) -- 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=84349831iu=/4140/ostg.clktrk ___ mseide-msegui-talk mailing list mseide-msegui-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk
Re: [MSEide-MSEgui-talk] MSElang, implicit type conversions
On Tuesday 17 December 2013 19:14:24 Ivanko B wrote: This may be considered as a joke by non-devoted people :) Why? What about Delphi cardinalvar:= $; integervar:= abs(cardinalvar); ? BTW, Free Pascal has no unsigned abs(). http://www.freepascal.org/docs-html/rtl/system/abs.html Martin -- 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=84349831iu=/4140/ostg.clktrk ___ mseide-msegui-talk mailing list mseide-msegui-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk
Re: [MSEide-MSEgui-talk] MSElang, implicit type conversions
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=84349831iu=/4140/ostg.clktrk ___ mseide-msegui-talk mailing list mseide-msegui-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk
Re: [MSEide-MSEgui-talk] MSElang, implicit type conversions
unsigned = signed = doing_smth = unsigned instead of doing_smth(unsigned) -- 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=84349831iu=/4140/ostg.clktrk ___ mseide-msegui-talk mailing list mseide-msegui-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk
Re: [MSEide-MSEgui-talk] MSElang, implicit type conversions
On Tuesday 17 December 2013 19:31:21 Ivanko B wrote: unsigned = signed = doing_smth = unsigned instead of doing_smth(unsigned) There is no abs() for unsigned - one can not do doing_smth(unsigned) with abs(). -- 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=84349831iu=/4140/ostg.clktrk ___ mseide-msegui-talk mailing list mseide-msegui-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk
Re: [MSEide-MSEgui-talk] MSElang, implicit type conversions
On Tuesday 17 December 2013 20:24:27 Sieghard wrote: BUT: Does anybody _really_ think that type casting _does_ something? A type cast, CPU wise, is a no-op, quite simply. Correct, if the sizes of the types are the same a type conversion says to the compiler I know what I do. For the conversion from smaller to bigger it either - sign extends the value if the conversion is signed to signed: int32var:= int32(int16value); - it fills the upper bytes with 0 if the smaller or the bigger is unsigned: card32var:= card32(card16value); card32var:= card32(int16value); //possible range check? int32var:= int32(card16value); If the conversion is from bigger to smaller it truncates to the lower bytes with a possible range check. card16var:= card16(card32value); card16var:= card16(int32value); int16var:= int16(card32value); int16var:= int16(int32value); Martin -- 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=84349831iu=/4140/ostg.clktrk ___ mseide-msegui-talk mailing list mseide-msegui-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk