Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.c++ > #41160
| From | bartekltg <bartekltg@gmail.com> |
|---|---|
| Newsgroups | comp.lang.c++ |
| Subject | Re: C++ complex.h protability |
| Date | 2016-02-23 10:55 +0100 |
| Organization | ATMAN - ATM S.A. |
| Message-ID | <nahaab$hpn$1@node1.news.atman.pl> (permalink) |
| References | <nach82$2uq$1@gwaiyur.mb-net.net> <nacm34$9hk$1@dont-email.me> <nad1ku$a8d$1@gwaiyur.mb-net.net> <nad8m4$knj$1@dont-email.me> |
On 21.02.2016 22:05, Alf P. Steinbach wrote: > On 21.02.2016 20:02, Marcel Mueller wrote: >> On 21.02.16 16.48, Alf P. Steinbach wrote: >>>> In fact older C++ compilers required the include files with the .h >>>> extension (and no namespace std::), i.e. >>>> #include <math.h> >>>> #include <complex.h> >>> >>> I believe the requirement had to be imposed by the FFTW3 headers. >>> >>> No compilers can have imposed this requirement. >> >> 15 to 20 years ago all you get by #include <math> was "File not found". > > There is no standard library header <math> and never has been. > > There is a C++ standard library header <complex>. It's different from > <ccomplex> and <complex.h>. It has changed ;-) "26.4.11 Header <ccomplex> [ccmplx] 1 The header behaves as if it simply includes the header <complex>." BTW, since, I think, c++11 there is a binary compatibility with C complex. I think this is because of : " 26.4: ... If z is an lvalue expression of type cv std::complex<T> then: (4.1) — the expression reinterpret_cast<cv T(&)[2]>(z) shall be well-formed, (4.2) — reinterpret_cast<cv T(&)[2]>(z)[0] shall designate the real part of z, and (4.3) — reinterpret_cast<cv T(&)[2]>(z)[1] shall designate the imaginary part of z. Moreover, if a is an expression of type cv std::complex<T>* and the expression a[i] is well-defined for an integer expression i, then: (4.4) — reinterpret_cast<cv T*>(a)[2*i] shall designate the real part of a[i], and (4.5) — reinterpret_cast<cv T*>(a)[2*i + 1] shall designate the imaginary part of a[i]. " > >> The lines with the #ifdef __cplusplus are a hack specific to this >> application to make the C++ application work reasonably with FFTW >> without the need for dirty reinterpret casts all the way. Older C++ >> compilers did not support C99 _Complex, and the fallback to C[2] is >> really ugly, since it makes trivial mathematical operations like >> multiplication unreadable. > > Do you really need to support C89/C90 compilers? > > Is it really the case that someone has not upgraded their compiler > version since 1999, can't be told to do that, and are IMPORTANT? > > Maybe this problem is more of a people & politics problem than a > technical one? I think the problem is with libraries based on fortran (with C interface). Then reinterpreted cast is needed, but at least should work. bast Bartekltg
Back to comp.lang.c++ | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
C++ complex.h protability Marcel Mueller <news.5.maazl@spamgourmet.org> - 2016-02-21 15:22 +0100
Re: C++ complex.h protability "Alf P. Steinbach" <alf.p.steinbach+usenet@gmail.com> - 2016-02-21 16:48 +0100
Re: C++ complex.h protability Marcel Mueller <news.5.maazl@spamgourmet.org> - 2016-02-21 20:02 +0100
Re: C++ complex.h protability Jerry Stuckle <jstucklex@attglobal.net> - 2016-02-21 14:25 -0500
Re: C++ complex.h protability Marcel Mueller <news.5.maazl@spamgourmet.org> - 2016-02-21 23:43 +0100
Re: C++ complex.h protability Jerry Stuckle <jstucklex@attglobal.net> - 2016-02-21 20:44 -0500
Re: C++ complex.h protability Marcel Mueller <news.5.maazl@spamgourmet.org> - 2016-02-22 19:38 +0100
Re: C++ complex.h protability Jerry Stuckle <jstucklex@attglobal.net> - 2016-02-22 14:14 -0500
Re: C++ complex.h protability Cholo Lennon <chololennon@hotmail.com> - 2016-02-22 16:36 -0300
Re: C++ complex.h protability Ian Collins <ian-news@hotmail.com> - 2016-02-23 08:53 +1300
Re: C++ complex.h protability Cholo Lennon <chololennon@hotmail.com> - 2016-02-22 17:03 -0300
Re: C++ complex.h protability Jerry Stuckle <jstucklex@attglobal.net> - 2016-02-22 15:16 -0500
Re: C++ complex.h protability "Alf P. Steinbach" <alf.p.steinbach+usenet@gmail.com> - 2016-02-22 21:38 +0100
Re: C++ complex.h protability Cholo Lennon <chololennon@hotmail.com> - 2016-02-22 17:50 -0300
Re: C++ complex.h protability Cholo Lennon <chololennon@hotmail.com> - 2016-02-22 18:09 -0300
Re: C++ complex.h protability legalize+jeeves@mail.xmission.com (Richard) - 2016-02-22 21:20 +0000
Re: C++ complex.h protability Öö Tiib <ootiib@hot.ee> - 2016-02-22 12:47 -0800
Re: C++ complex.h protability Jerry Stuckle <jstucklex@attglobal.net> - 2016-02-22 16:18 -0500
Re: C++ complex.h protability Öö Tiib <ootiib@hot.ee> - 2016-02-22 13:51 -0800
Re: C++ complex.h protability Jerry Stuckle <jstucklex@attglobal.net> - 2016-02-22 16:57 -0500
Re: C++ complex.h protability legalize+jeeves@mail.xmission.com (Richard) - 2016-02-22 22:16 +0000
Re: C++ complex.h protability Öö Tiib <ootiib@hot.ee> - 2016-02-22 15:09 -0800
Re: C++ complex.h protability Jerry Stuckle <jstucklex@attglobal.net> - 2016-02-22 19:53 -0500
Re: C++ complex.h protability Öö Tiib <ootiib@hot.ee> - 2016-02-22 23:23 -0800
Re: C++ complex.h protability Robert Wessel <robertwessel2@yahoo.com> - 2016-02-22 02:54 -0600
Re: C++ complex.h protability "Alf P. Steinbach" <alf.p.steinbach+usenet@gmail.com> - 2016-02-21 22:05 +0100
Re: C++ complex.h protability bartekltg <bartekltg@gmail.com> - 2016-02-23 10:55 +0100
Re: C++ complex.h protability "Alf P. Steinbach" <alf.p.steinbach+usenet@gmail.com> - 2016-02-23 19:45 +0100
Re: C++ complex.h protability "Alf P. Steinbach" <alf.p.steinbach+usenet@gmail.com> - 2016-02-23 19:55 +0100
Re: C++ complex.h protability bartekltg <bartekltg@gmail.com> - 2016-02-23 20:41 +0100
Re: C++ complex.h protability "Alf P. Steinbach" <alf.p.steinbach+usenet@gmail.com> - 2016-02-23 22:26 +0100
Re: C++ complex.h protability Christian Gollwitzer <auriocus@gmx.de> - 2016-02-22 08:16 +0100
Re: C++ complex.h protability Öö Tiib <ootiib@hot.ee> - 2016-02-22 02:06 -0800
Re: C++ complex.h protability Ian Collins <ian-news@hotmail.com> - 2016-02-22 09:00 +1300
Re: C++ complex.h protability Marcel Mueller <news.5.maazl@spamgourmet.org> - 2016-02-21 23:51 +0100
Re: C++ complex.h protability Öö Tiib <ootiib@hot.ee> - 2016-02-21 15:41 -0800
Re: C++ complex.h protability "Alf P. Steinbach" <alf.p.steinbach+usenet@gmail.com> - 2016-02-22 00:50 +0100
csiph-web