Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.unix.programmer > #8125
| From | Rainer Weikusat <rweikusat@talktalk.net> |
|---|---|
| Newsgroups | comp.unix.programmer |
| Subject | Re: Odd compiler behaviour? |
| Date | 2016-03-10 19:51 +0000 |
| Message-ID | <87k2lat8kh.fsf@doppelsaurus.mobileactivedefense.com> (permalink) |
| References | <nb3t47$19o6$1@gioia.aioe.org> <nbmt79$127e$1@gioia.aioe.org> <20160310073739.787@kylheku.com> <nbs64g$11q2$1@gioia.aioe.org> <20160310141206.690dee00e1890c1c28ec7eed@speakeasy.net> |
"James K. Lowden" <jklowden@speakeasy.net> writes: > spud@potato.field wrote: > >> >It's overloaded; it's doing different kinds of addition. >> >Without overloading, you need a different + operator for >> >floating-point. >> >> Its still addition! The meaning is identical! >> >> The only reason overloading of the maths op is needed is because of >> current CPU architecture. There is no conceptual difference. > > The difference has nothing to do with the CPU and everything to do with > the language. Please see abs(3) and fabs(3). Two functions are needed > because the arguments are of different *types*. That would be true even > on a machine that implemented floating point in software. But the arguments are of different types because of "CPU architectures" supporting different 'kinds' of numbers with different properties and representations. Which is at odd with the naive idea of 'arithmetic' as something which is performed 'on numbers'. This usually includes (sums of) decimal fractions in the common notation for that and usually doesn't include complex numbers or other fractions. > The operator + is a binary function. 'operator +' implementations in C++ are binary functions. But the C '+' operator isn't. It's a special language construct which can appear in an additive expression. If it does, it's supposed to have two operands. Either both must 'have an arithmetic type', ie, be integers or floats, or one must be a pointer and the other an integer. In order to perform an arithmetic addition, the compiler is supposed to determine a 'common real type' for both operands. Both operands are supposed to be converted to this common real type. The addition is then performed with the results of these conversions. Considering that the compiler is supposed to generate code based on the types of the actual operands, the way to approximate this in C++ would really rather be a template function with two template arguments. But that's not good enough because the type of the return value depends on the types of both arguments.
Back to comp.unix.programmer | Previous | Next — Previous in thread | Next in thread | Find similar
Odd compiler behaviour? spud@potato.field - 2016-03-01 11:06 +0000
Re: Odd compiler behaviour? David Brown <david.brown@hesbynett.no> - 2016-03-01 12:57 +0100
Re: Odd compiler behaviour? spud@potato.field - 2016-03-01 13:48 +0000
Re: Odd compiler behaviour? David Brown <david.brown@hesbynett.no> - 2016-03-01 15:46 +0100
Re: Odd compiler behaviour? spud@potato.field - 2016-03-01 15:08 +0000
Re: Odd compiler behaviour? Keith Thompson <kst-u@mib.org> - 2016-03-01 08:36 -0800
Re: Odd compiler behaviour? spud@potato.field - 2016-03-01 16:47 +0000
Re: Odd compiler behaviour? Keith Thompson <kst-u@mib.org> - 2016-03-01 08:51 -0800
Re: Odd compiler behaviour? spud@potato.field - 2016-03-01 17:05 +0000
Re: Odd compiler behaviour? Geoff <geoff@invalid.invalid> - 2016-03-01 10:00 -0800
Re: Odd compiler behaviour? Keith Thompson <kst-u@mib.org> - 2016-03-01 10:56 -0800
Re: Odd compiler behaviour? spud@potato.field - 2016-03-02 09:42 +0000
Re: Odd compiler behaviour? Keith Thompson <kst-u@mib.org> - 2016-03-01 10:55 -0800
Re: Odd compiler behaviour? spud@potato.field - 2016-03-02 09:46 +0000
Re: Odd compiler behaviour? Kaz Kylheku <330-706-9395@kylheku.com> - 2016-03-01 20:59 +0000
Re: Odd compiler behaviour? Geoff <geoff@invalid.invalid> - 2016-03-01 10:09 -0800
Re: Odd compiler behaviour? Richard Kettlewell <rjk@greenend.org.uk> - 2016-03-01 13:03 +0000
Re: Odd compiler behaviour? spud@potato.field - 2016-03-01 13:54 +0000
Re: Odd compiler behaviour? Kaz Kylheku <330-706-9395@kylheku.com> - 2016-03-01 14:15 +0000
Re: Odd compiler behaviour? spud@potato.field - 2016-03-01 14:38 +0000
Re: Odd compiler behaviour? Kaz Kylheku <330-706-9395@kylheku.com> - 2016-03-01 14:59 +0000
Re: Odd compiler behaviour? Barry Margolin <barmar@alum.mit.edu> - 2016-03-01 11:20 -0500
Re: Odd compiler behaviour? Keith Thompson <kst-u@mib.org> - 2016-03-01 08:45 -0800
Re: Odd compiler behaviour? Richard Kettlewell <rjk@greenend.org.uk> - 2016-03-01 16:54 +0000
Re: Odd compiler behaviour? Barry Margolin <barmar@alum.mit.edu> - 2016-03-01 13:14 -0500
Re: Odd compiler behaviour? Richard Kettlewell <rjk@greenend.org.uk> - 2016-03-01 19:10 +0000
Re: Odd compiler behaviour? Rainer Weikusat <rweikusat@talktalk.net> - 2016-03-01 19:26 +0000
Re: Odd compiler behaviour? Richard Kettlewell <rjk@greenend.org.uk> - 2016-03-01 19:57 +0000
Re: Odd compiler behaviour? Noob <root@127.0.0.1> - 2016-03-01 21:07 +0100
Re: Odd compiler behaviour? Barry Margolin <barmar@alum.mit.edu> - 2016-03-01 15:40 -0500
Re: Odd compiler behaviour? Richard Kettlewell <rjk@greenend.org.uk> - 2016-03-01 21:14 +0000
Re: Odd compiler behaviour? Rainer Weikusat <rweikusat@talktalk.net> - 2016-03-01 21:20 +0000
Re: Odd compiler behaviour? Kaz Kylheku <330-706-9395@kylheku.com> - 2016-03-01 21:59 +0000
Re: Odd compiler behaviour? Rainer Weikusat <rweikusat@talktalk.net> - 2016-03-01 22:09 +0000
Re: Odd compiler behaviour? Richard Kettlewell <rjk@greenend.org.uk> - 2016-03-01 23:04 +0000
Re: Odd compiler behaviour? Barry Margolin <barmar@alum.mit.edu> - 2016-03-01 17:08 -0500
Re: Odd compiler behaviour? Richard Kettlewell <rjk@greenend.org.uk> - 2016-03-01 22:59 +0000
Re: Odd compiler behaviour? Barry Margolin <barmar@alum.mit.edu> - 2016-03-02 10:39 -0500
Re: Odd compiler behaviour? Richard Kettlewell <rjk@greenend.org.uk> - 2016-03-02 16:19 +0000
Re: Odd compiler behaviour? Barry Margolin <barmar@alum.mit.edu> - 2016-03-02 11:56 -0500
Re: Odd compiler behaviour? Richard Kettlewell <rjk@greenend.org.uk> - 2016-03-02 17:21 +0000
Re: Odd compiler behaviour? Barry Margolin <barmar@alum.mit.edu> - 2016-03-02 12:42 -0500
Re: Odd compiler behaviour? Richard Kettlewell <rjk@greenend.org.uk> - 2016-03-02 18:03 +0000
Re: Odd compiler behaviour? Keith Thompson <kst-u@mib.org> - 2016-03-02 10:41 -0800
Re: Odd compiler behaviour? Richard Kettlewell <rjk@greenend.org.uk> - 2016-03-02 18:59 +0000
Re: Odd compiler behaviour? Keith Thompson <kst-u@mib.org> - 2016-03-02 11:40 -0800
Re: Odd compiler behaviour? Richard Kettlewell <rjk@greenend.org.uk> - 2016-03-02 20:05 +0000
Re: Odd compiler behaviour? Barry Margolin <barmar@alum.mit.edu> - 2016-03-02 15:32 -0500
Re: Odd compiler behaviour? Richard Kettlewell <rjk@greenend.org.uk> - 2016-03-02 20:51 +0000
Re: Odd compiler behaviour? Barry Margolin <barmar@alum.mit.edu> - 2016-03-02 16:01 -0500
Re: Odd compiler behaviour? Richard Kettlewell <rjk@greenend.org.uk> - 2016-03-02 21:10 +0000
Re: Odd compiler behaviour? Barry Margolin <barmar@alum.mit.edu> - 2016-03-02 16:41 -0500
Re: Odd compiler behaviour? Keith Thompson <kst-u@mib.org> - 2016-03-02 13:52 -0800
Re: Odd compiler behaviour? Richard Kettlewell <rjk@greenend.org.uk> - 2016-03-02 22:14 +0000
Re: Odd compiler behaviour? "James K. Lowden" <jklowden@speakeasy.net> - 2016-03-02 18:54 -0500
Re: Odd compiler behaviour? gazelle@shell.xmission.com (Kenny McCormack) - 2016-03-02 21:30 +0000
Re: Odd compiler behaviour? Keith Thompson <kst-u@mib.org> - 2016-03-02 13:34 -0800
Re: Odd compiler behaviour? Jorgen Grahn <grahn+nntp@snipabacken.se> - 2016-03-05 16:48 +0000
Re: Odd compiler behaviour? "James K. Lowden" <jklowden@speakeasy.net> - 2016-03-05 15:29 -0500
Re: Odd compiler behaviour? Eric Sosman <esosman@comcast-dot-net.invalid> - 2016-03-05 15:41 -0500
Re: Odd compiler behaviour? Barry Margolin <barmar@alum.mit.edu> - 2016-03-05 23:19 -0500
Re: Odd compiler behaviour? Rainer Weikusat <rweikusat@talktalk.net> - 2016-03-06 12:44 +0000
Re: Odd compiler behaviour? Barry Margolin <barmar@alum.mit.edu> - 2016-03-06 14:10 -0500
Re: Odd compiler behaviour? spud@potato.field - 2016-03-07 09:53 +0000
Re: Odd compiler behaviour? Rainer Weikusat <rweikusat@talktalk.net> - 2016-03-08 12:59 +0000
Re: Odd compiler behaviour? spud@potato.field - 2016-03-08 13:59 +0000
Re: Odd compiler behaviour? Rainer Weikusat <rweikusat@talktalk.net> - 2016-03-08 15:28 +0000
Re: Odd compiler behaviour? Barry Margolin <barmar@alum.mit.edu> - 2016-03-08 10:42 -0500
Re: Odd compiler behaviour? Kaz Kylheku <330-706-9395@kylheku.com> - 2016-03-08 17:09 +0000
Re: Odd compiler behaviour? Rainer Weikusat <rweikusat@talktalk.net> - 2016-03-08 20:38 +0000
Re: Odd compiler behaviour? Rainer Weikusat <rweikusat@talktalk.net> - 2016-03-08 22:15 +0000
Re: Odd compiler behaviour? Joe Pfeiffer <pfeiffer@cs.nmsu.edu> - 2016-03-08 16:21 -0700
Re: Odd compiler behaviour? Eric Sosman <esosman@comcast-dot-net.invalid> - 2016-03-08 10:47 -0500
Re: Odd compiler behaviour? spud@potato.field - 2016-03-08 16:04 +0000
Re: Odd compiler behaviour? "James K. Lowden" <jklowden@speakeasy.net> - 2016-03-09 00:21 -0500
Re: Odd compiler behaviour? spud@potato.field - 2016-03-09 09:40 +0000
Re: Odd compiler behaviour? David Brown <david.brown@hesbynett.no> - 2016-03-09 11:31 +0100
Re: Odd compiler behaviour? BartC <bc@freeuk.com> - 2016-03-09 11:21 +0000
Re: Odd compiler behaviour? David Brown <david.brown@hesbynett.no> - 2016-03-09 12:57 +0100
Re: Odd compiler behaviour? Kaz Kylheku <330-706-9395@kylheku.com> - 2016-03-09 15:32 +0000
Re: Odd compiler behaviour? Robert Wessel <robertwessel2@yahoo.com> - 2016-03-09 11:13 -0600
Re: Odd compiler behaviour? Les Cargill <lcargill99@comcast.com> - 2016-03-09 07:16 -0600
Re: Odd compiler behaviour? spud@potato.field - 2016-03-09 13:19 +0000
Re: Odd compiler behaviour? Jerry Stuckle <jstucklex@attglobal.net> - 2016-03-09 09:28 -0500
Re: Odd compiler behaviour? Kaz Kylheku <330-706-9395@kylheku.com> - 2016-03-09 15:35 +0000
Re: Odd compiler behaviour? Jerry Stuckle <jstucklex@attglobal.net> - 2016-03-09 11:08 -0500
Re: Odd compiler behaviour? spud@potato.field - 2016-03-09 13:32 +0000
Re: Odd compiler behaviour? Nicolas George <nicolas$george@salle-s.org> - 2016-03-09 13:34 +0000
Re: Odd compiler behaviour? spud@potato.field - 2016-03-09 16:17 +0000
Re: Odd compiler behaviour? Nicolas George <nicolas$george@salle-s.org> - 2016-03-09 16:54 +0000
Re: Odd compiler behaviour? Kaz Kylheku <330-706-9395@kylheku.com> - 2016-03-09 19:45 +0000
Re: Odd compiler behaviour? spud@potato.field - 2016-03-10 09:34 +0000
Re: Odd compiler behaviour? Kaz Kylheku <330-706-9395@kylheku.com> - 2016-03-10 15:40 +0000
Re: Odd compiler behaviour? Rainer Weikusat <rweikusat@talktalk.net> - 2016-03-10 15:57 +0000
Re: Odd compiler behaviour? spud@potato.field - 2016-03-10 16:07 +0000
Re: Odd compiler behaviour? "James K. Lowden" <jklowden@speakeasy.net> - 2016-03-10 14:12 -0500
Re: Odd compiler behaviour? Rainer Weikusat <rweikusat@talktalk.net> - 2016-03-10 19:51 +0000
Re: Odd compiler behaviour? Kaz Kylheku <330-706-9395@kylheku.com> - 2016-03-10 20:08 +0000
Re: Odd compiler behaviour? Rainer Weikusat <rweikusat@talktalk.net> - 2016-03-10 22:31 +0000
Re: Odd compiler behaviour? Rainer Weikusat <rweikusat@talktalk.net> - 2016-03-10 22:55 +0000
Re: Odd compiler behaviour? "James K. Lowden" <jklowden@speakeasy.net> - 2016-03-10 17:25 -0500
Re: Odd compiler behaviour? Rainer Weikusat <rweikusat@talktalk.net> - 2016-03-11 17:49 +0000
Re: Odd compiler behaviour? Keith Thompson <kst-u@mib.org> - 2016-03-12 18:11 -0800
Re: Odd compiler behaviour? spud@potato.field - 2016-03-14 09:43 +0000
Re: Odd compiler behaviour? Kaz Kylheku <330-706-9395@kylheku.com> - 2016-03-14 15:57 +0000
Re: Odd compiler behaviour? "James K. Lowden" <jklowden@speakeasy.net> - 2016-03-14 12:16 -0400
Re: Odd compiler behaviour? spud@potato.field - 2016-03-14 17:00 +0000
Re: Odd compiler behaviour? Rainer Weikusat <rweikusat@talktalk.net> - 2016-03-14 17:14 +0000
Re: Odd compiler behaviour? Kaz Kylheku <330-706-9395@kylheku.com> - 2016-03-14 18:29 +0000
Re: Odd compiler behaviour? Kaz Kylheku <330-706-9395@kylheku.com> - 2016-03-14 18:46 +0000
Re: Odd compiler behaviour? "James K. Lowden" <jklowden@speakeasy.net> - 2016-03-14 18:16 -0400
Re: Odd compiler behaviour? Ian Collins <ian-news@hotmail.com> - 2016-03-15 20:45 +1300
Re: Odd compiler behaviour? spud@potato.field - 2016-03-15 09:25 +0000
Re: Odd compiler behaviour? Ian Collins <ian-news@hotmail.com> - 2016-03-15 22:36 +1300
Re: Odd compiler behaviour? spud@potato.field - 2016-03-15 10:23 +0000
Re: Odd compiler behaviour? "James K. Lowden" <jklowden@speakeasy.net> - 2016-03-15 10:11 -0400
Re: Odd compiler behaviour? Kaz Kylheku <330-706-9395@kylheku.com> - 2016-03-15 14:33 +0000
Re: Odd compiler behaviour? spud@potato.field - 2016-03-15 15:41 +0000
Re: Odd compiler behaviour? "James K. Lowden" <jklowden@speakeasy.net> - 2016-03-17 18:18 -0400
Re: Odd compiler behaviour? Nicolas George <nicolas$george@salle-s.org> - 2016-03-17 23:01 +0000
Re: Odd compiler behaviour? spud@potato.field - 2016-03-18 09:44 +0000
Re: Odd compiler behaviour? Ian Collins <ian-news@hotmail.com> - 2016-03-29 11:31 +1300
Re: Odd compiler behaviour? spud@potato.field - 2016-03-29 08:32 +0000
Re: Odd compiler behaviour? Ian Collins <ian-news@hotmail.com> - 2016-03-29 21:46 +1300
Re: Odd compiler behaviour? spud@potato.field - 2016-03-29 09:25 +0000
Re: Odd compiler behaviour? scott@slp53.sl.home (Scott Lurndal) - 2016-03-29 13:22 +0000
Re: Odd compiler behaviour? spud@potato.field - 2016-03-29 14:07 +0000
Re: Odd compiler behaviour? Rainer Weikusat <rweikusat@talktalk.net> - 2016-03-29 15:59 +0100
Re: Odd compiler behaviour? spud@potato.field - 2016-03-29 15:12 +0000
Re: Odd compiler behaviour? Rainer Weikusat <rweikusat@talktalk.net> - 2016-03-29 17:27 +0100
Re: Odd compiler behaviour? spud@potato.field - 2016-03-30 08:35 +0000
Re: Odd compiler behaviour? scott@slp53.sl.home (Scott Lurndal) - 2016-03-29 16:29 +0000
Re: Odd compiler behaviour? spud@potato.field - 2016-03-30 08:23 +0000
Re: Odd compiler behaviour? scott@slp53.sl.home (Scott Lurndal) - 2016-03-30 13:14 +0000
Re: Odd compiler behaviour? spud@potato.field - 2016-03-30 13:38 +0000
Re: Odd compiler behaviour? scott@slp53.sl.home (Scott Lurndal) - 2016-03-30 15:20 +0000
Re: Odd compiler behaviour? scott@slp53.sl.home (Scott Lurndal) - 2016-03-29 16:23 +0000
Re: Odd compiler behaviour? Rainer Weikusat <rweikusat@talktalk.net> - 2016-03-18 15:58 +0000
Re: Odd compiler behaviour? spud@potato.field - 2016-03-18 16:20 +0000
Re: Odd compiler behaviour? "James K. Lowden" <jklowden@speakeasy.net> - 2016-03-19 02:46 -0400
Re: Odd compiler behaviour? Rainer Weikusat <rweikusat@talktalk.net> - 2016-03-15 15:42 +0000
Re: Odd compiler behaviour? Kaz Kylheku <330-706-9395@kylheku.com> - 2016-03-15 21:55 +0000
Re: Odd compiler behaviour? scott@slp53.sl.home (Scott Lurndal) - 2016-03-15 13:37 +0000
Re: Odd compiler behaviour? Jorgen Grahn <grahn+nntp@snipabacken.se> - 2016-03-31 19:25 +0000
Re: Odd compiler behaviour? David Brown <david.brown@hesbynett.no> - 2016-03-09 15:17 +0100
Re: Odd compiler behaviour? spud@potato.field - 2016-03-09 16:23 +0000
Re: Odd compiler behaviour? David Brown <david.brown@hesbynett.no> - 2016-03-09 19:30 +0100
Re: Odd compiler behaviour? Jerry Stuckle <jstucklex@attglobal.net> - 2016-03-09 14:40 -0500
Re: Odd compiler behaviour? spud@potato.field - 2016-03-10 09:28 +0000
Re: Odd compiler behaviour? David Brown <david.brown@hesbynett.no> - 2016-03-10 10:57 +0100
Re: Odd compiler behaviour? spud@potato.field - 2016-03-10 10:29 +0000
Re: Odd compiler behaviour? David Brown <david.brown@hesbynett.no> - 2016-03-10 12:50 +0100
Re: Odd compiler behaviour? Rainer Weikusat <rweikusat@talktalk.net> - 2016-03-10 12:21 +0000
Re: Odd compiler behaviour? spud@potato.field - 2016-03-10 12:22 +0000
Re: Odd compiler behaviour? BartC <bc@freeuk.com> - 2016-03-10 13:01 +0000
Re: Odd compiler behaviour? spud@potato.field - 2016-03-10 13:55 +0000
Re: Odd compiler behaviour? Keith Thompson <kst-u@mib.org> - 2016-03-10 08:29 -0800
Re: Odd compiler behaviour? gordonb.uf2r1@burditt.org (Gordon Burditt) - 2016-03-12 03:36 -0600
Re: Odd compiler behaviour? Richard Damon <Richard@Damon-Family.org> - 2016-03-12 10:13 -0500
Re: Odd compiler behaviour? David Brown <david.brown@hesbynett.no> - 2016-03-13 23:11 +0100
Re: Odd compiler behaviour? Rainer Weikusat <rweikusat@talktalk.net> - 2016-03-13 22:12 +0000
succint expressions (was: Odd compiler behaviour?) Rainer Weikusat <rweikusat@talktalk.net> - 2016-03-09 11:04 +0000
Re: Odd compiler behaviour? BartC <bc@freeuk.com> - 2016-03-09 11:39 +0000
Re: Odd compiler behaviour? "James K. Lowden" <jklowden@speakeasy.net> - 2016-03-09 19:51 -0500
Re: Odd compiler behaviour? Ben Bacarisse <ben.usenet@bsb.me.uk> - 2016-03-10 01:00 +0000
Re: Odd compiler behaviour? Jerry Stuckle <jstucklex@attglobal.net> - 2016-03-09 09:27 -0500
Re: Odd compiler behaviour? Kaz Kylheku <330-706-9395@kylheku.com> - 2016-03-09 15:24 +0000
Re: Odd compiler behaviour? Jerry Stuckle <jstucklex@attglobal.net> - 2016-03-09 11:10 -0500
Re: Odd compiler behaviour? Kaz Kylheku <330-706-9395@kylheku.com> - 2016-03-09 19:14 +0000
Re: Odd compiler behaviour? scott@slp53.sl.home (Scott Lurndal) - 2016-03-09 20:18 +0000
Re: Odd compiler behaviour? gordonb.2x965@burditt.org (Gordon Burditt) - 2016-03-14 23:45 -0500
Re: Odd compiler behaviour? Rainer Weikusat <rweikusat@talktalk.net> - 2016-03-09 16:11 +0000
Re: Odd compiler behaviour? David Brown <david.brown@hesbynett.no> - 2016-03-09 19:37 +0100
Re: Odd compiler behaviour? Kaz Kylheku <330-706-9395@kylheku.com> - 2016-03-09 19:34 +0000
Re: Odd compiler behaviour? Rainer Weikusat <rweikusat@talktalk.net> - 2016-03-09 20:05 +0000
[OT] Re: Odd compiler behaviour? Eric Sosman <esosman@comcast-dot-net.invalid> - 2016-03-09 15:13 -0500
Re: Odd compiler behaviour? "James K. Lowden" <jklowden@speakeasy.net> - 2016-03-09 19:51 -0500
Re: Odd compiler behaviour? Rainer Weikusat <rweikusat@talktalk.net> - 2016-03-10 15:35 +0000
Re: Odd compiler behaviour? "James K. Lowden" <jklowden@speakeasy.net> - 2016-03-09 00:21 -0500
Re: Odd compiler behaviour? Kaz Kylheku <330-706-9395@kylheku.com> - 2016-03-01 21:01 +0000
Re: Odd compiler behaviour? raltbos@xs4all.nl (Richard Bos) - 2016-03-02 12:09 +0000
Re: Odd compiler behaviour? scott@slp53.sl.home (Scott Lurndal) - 2016-03-01 14:18 +0000
Re: Odd compiler behaviour? raltbos@xs4all.nl (Richard Bos) - 2016-03-02 12:53 +0000
Re: Odd compiler behaviour? Noob <root@127.0.0.1> - 2016-03-01 16:44 +0100
Re: Odd compiler behaviour? Geoff <geoff@invalid.invalid> - 2016-03-01 09:22 -0800
Re: Odd compiler behaviour? David Thompson <dave.thompson2@verizon.net> - 2016-03-20 07:12 -0400
csiph-web