Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.c++ > #41080 > unrolled thread
| Started by | Marcel Mueller <news.5.maazl@spamgourmet.org> |
|---|---|
| First post | 2016-02-21 15:22 +0100 |
| Last post | 2016-02-22 00:50 +0100 |
| Articles | 17 on this page of 37 — 10 participants |
Back to article view | Back to comp.lang.c++
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
Page 2 of 2 — ← Prev page 1 [2]
| From | legalize+jeeves@mail.xmission.com (Richard) |
|---|---|
| Date | 2016-02-22 22:16 +0000 |
| Message-ID | <nag1bg$hdg$1@news.xmission.com> |
| In reply to | #41134 |
[Please do not mail me a copy of your followup]
Jerry Stuckle <jstucklex@attglobal.net> spake the secret code
<nag03g$b68$1@jstuckle.eternal-september.org> thusly:
>Visual C++ came out long before 1998.
<https://en.wikipedia.org/wiki/Visual_C%2B%2B>
Visual C++ 1.0 was released in 1993. The first C++ compiler was 1992.
The C compiler was introduced in 1983.
--
"The Direct3D Graphics Pipeline" free book <http://tinyurl.com/d3d-pipeline>
The Computer Graphics Museum <http://computergraphicsmuseum.org>
The Terminals Wiki <http://terminals.classiccmp.org>
Legalize Adulthood! (my blog) <http://legalizeadulthood.wordpress.com>
[toc] | [prev] | [next] | [standalone]
| From | Öö Tiib <ootiib@hot.ee> |
|---|---|
| Date | 2016-02-22 15:09 -0800 |
| Message-ID | <94f809ca-ed22-4f44-888f-38e769a9cbf5@googlegroups.com> |
| In reply to | #41134 |
On Monday, 22 February 2016 23:58:17 UTC+2, Jerry Stuckle wrote: > On 2/22/2016 4:51 PM, Öö Tiib wrote: > > On Monday, 22 February 2016 23:19:07 UTC+2, Jerry Stuckle wrote: > >> On 2/22/2016 3:47 PM, Öö Tiib wrote: > >>> On Monday, 22 February 2016 22:16:28 UTC+2, Jerry Stuckle wrote: > >>>> On 2/22/2016 2:53 PM, Ian Collins wrote: > >>>>> Cholo Lennon wrote: > >>>>>> On 02/21/2016 10:44 PM, Jerry Stuckle wrote: > >>>>>>> On 2/21/2016 5:43 PM, Marcel Mueller wrote: > >>>>>>>> On 21.02.16 20.25, Jerry Stuckle wrote: > >>>>>>>>> > >>>>>>>>> "namespace" has existed for at least 25 years. I'm not sure exactly > >>>>>>>>> which standard had it first, but we were using it in the early 90's. > >>>>>>>> > >>>>>>>> All my complilers from the mid 90's can't deal with namespaces. Neither > >>>>>>>> Borland supported them nor IBM VAC++ and AFAIR gcc 2.9.5 did not > >>>>>>>> support > >>>>>>>> it either. > >>>>>>>> > >>>>>>> > >>>>>>> Sorry you had compilers which were not standards compliant. That does > >>>>>>> not mean it wasn't part of the standard. > >>>>>>> > >>>>>> > >>>>>> It's depends on what you define as C++ standard. Normally we tend to use > >>>>>> the ISO C++ as a reference (1998 or later). The ARM document (where > >>>>>> namespaces are described) is not considered "the" C++ standard. > >>>>> > >>>>> There weren't any standards compliant compilers in the early 90s because > >>>>> there wasn't a standard! > >>>>> > >>>> > >>>> Just because there wasn't an ISO standard at the time doesn't mean there > >>>> wasn't a standard. It started with Stroustrup's book. Modifications > >>>> followed from that. > >>>> > >>>> People think that ISO is the only organization which can issue > >>>> standards. Nothing is further from the truth. If they come out with a > >>>> standard, it is generally recognized world-wide. But when they haven't, > >>>> there can still be standards. > >>> > >>> Can you name the mysterious compiler? There was lot of talk of it but > >>> nothing supported it. First C++ that gave *warning* about usage of > >>> 'namespace' as variable name was CFront 3.0.3 released May 1994. It also > >>> did not yet have 'namespace' implemented, instead the README told that: > >>> > >>> The identifier names "mutable", "namespace", and "using" will > >>> now trigger a warning when they are used as identifiers. > >>> For example: > >>> > >>> int namespace = 37; > >>> > >>> This is because they are future keywords for the ANSI C++ language > >>> namespace feature. > >>> > >> > >> IBM's Visual C++ compiler for OS/2 and Windows did, for one. I don't > >> remember off hand what Linux compilers we used way back then. > > > > IBM VisualAge C++ added namespace support 2003 AFAIK, at 2000 it did > > have templates but no namespaces. > > > > VisualAge C++ for OS/2 and Windows didn't even exist in 2003. It had > been dropped several years before that. I don't remember exactly when, > though. OS/2 was long dead indeed but that VisualAge crap did still smoulder here and there. At 2000 its C++ certainly did not have namespaces. I trust it was 2011 when VisualAge was finally dropped and replaced with XL C/C++ by IBM. > > >> > >> And IIRC, even Microsoft Visual C++ 6.something supported them. But I > >> haven't used it for 15 years or more. > > > > Yes, I remember it, it had first nice IDE from MS and come shortly after > > first working OS from MS (NT 4.0). It was released in 1998. > > > > So how you could use those early nineties? > > > > Visual C++ came out long before 1998. Yes, looked it up https://support.microsoft.com/en-us/kb/145669 it seems that Visual C++ 4.00 were first that had namespaces (released at end of 1995). Borland C++ 5.0 released 1996 had also namespaces. So those were impossible to use in the early 90's without time machine.
[toc] | [prev] | [next] | [standalone]
| From | Jerry Stuckle <jstucklex@attglobal.net> |
|---|---|
| Date | 2016-02-22 19:53 -0500 |
| Message-ID | <nagace$gol$1@jstuckle.eternal-september.org> |
| In reply to | #41139 |
On 2/22/2016 6:09 PM, Öö Tiib wrote: > On Monday, 22 February 2016 23:58:17 UTC+2, Jerry Stuckle wrote: >> On 2/22/2016 4:51 PM, Öö Tiib wrote: >>> On Monday, 22 February 2016 23:19:07 UTC+2, Jerry Stuckle wrote: >>>> On 2/22/2016 3:47 PM, Öö Tiib wrote: >>>>> On Monday, 22 February 2016 22:16:28 UTC+2, Jerry Stuckle wrote: >>>>>> On 2/22/2016 2:53 PM, Ian Collins wrote: >>>>>>> Cholo Lennon wrote: >>>>>>>> On 02/21/2016 10:44 PM, Jerry Stuckle wrote: >>>>>>>>> On 2/21/2016 5:43 PM, Marcel Mueller wrote: >>>>>>>>>> On 21.02.16 20.25, Jerry Stuckle wrote: >>>>>>>>>>> >>>>>>>>>>> "namespace" has existed for at least 25 years. I'm not sure exactly >>>>>>>>>>> which standard had it first, but we were using it in the early 90's. >>>>>>>>>> >>>>>>>>>> All my complilers from the mid 90's can't deal with namespaces. Neither >>>>>>>>>> Borland supported them nor IBM VAC++ and AFAIR gcc 2.9.5 did not >>>>>>>>>> support >>>>>>>>>> it either. >>>>>>>>>> >>>>>>>>> >>>>>>>>> Sorry you had compilers which were not standards compliant. That does >>>>>>>>> not mean it wasn't part of the standard. >>>>>>>>> >>>>>>>> >>>>>>>> It's depends on what you define as C++ standard. Normally we tend to use >>>>>>>> the ISO C++ as a reference (1998 or later). The ARM document (where >>>>>>>> namespaces are described) is not considered "the" C++ standard. >>>>>>> >>>>>>> There weren't any standards compliant compilers in the early 90s because >>>>>>> there wasn't a standard! >>>>>>> >>>>>> >>>>>> Just because there wasn't an ISO standard at the time doesn't mean there >>>>>> wasn't a standard. It started with Stroustrup's book. Modifications >>>>>> followed from that. >>>>>> >>>>>> People think that ISO is the only organization which can issue >>>>>> standards. Nothing is further from the truth. If they come out with a >>>>>> standard, it is generally recognized world-wide. But when they haven't, >>>>>> there can still be standards. >>>>> >>>>> Can you name the mysterious compiler? There was lot of talk of it but >>>>> nothing supported it. First C++ that gave *warning* about usage of >>>>> 'namespace' as variable name was CFront 3.0.3 released May 1994. It also >>>>> did not yet have 'namespace' implemented, instead the README told that: >>>>> >>>>> The identifier names "mutable", "namespace", and "using" will >>>>> now trigger a warning when they are used as identifiers. >>>>> For example: >>>>> >>>>> int namespace = 37; >>>>> >>>>> This is because they are future keywords for the ANSI C++ language >>>>> namespace feature. >>>>> >>>> >>>> IBM's Visual C++ compiler for OS/2 and Windows did, for one. I don't >>>> remember off hand what Linux compilers we used way back then. >>> >>> IBM VisualAge C++ added namespace support 2003 AFAIK, at 2000 it did >>> have templates but no namespaces. >>> >> >> VisualAge C++ for OS/2 and Windows didn't even exist in 2003. It had >> been dropped several years before that. I don't remember exactly when, >> though. > > OS/2 was long dead indeed but that VisualAge crap did still smoulder > here and there. At 2000 its C++ certainly did not have namespaces. I trust > it was 2011 when VisualAge was finally dropped and replaced with > XL C/C++ by IBM. > >> >>>> >>>> And IIRC, even Microsoft Visual C++ 6.something supported them. But I >>>> haven't used it for 15 years or more. >>> >>> Yes, I remember it, it had first nice IDE from MS and come shortly after >>> first working OS from MS (NT 4.0). It was released in 1998. >>> >>> So how you could use those early nineties? >>> >> >> Visual C++ came out long before 1998. > > Yes, looked it up https://support.microsoft.com/en-us/kb/145669 it > seems that Visual C++ 4.00 were first that had namespaces (released at > end of 1995). Borland C++ 5.0 released 1996 had also namespaces. So > those were impossible to use in the early 90's without time machine. > Yea, right. Just the response I would expect from an ignorant troll. <plonk!> -- ================== Remove the "x" from my email address Jerry Stuckle jstucklex@attglobal.net ==================
[toc] | [prev] | [next] | [standalone]
| From | Öö Tiib <ootiib@hot.ee> |
|---|---|
| Date | 2016-02-22 23:23 -0800 |
| Message-ID | <34c197a3-3cb2-4f68-8c70-0faa8cbf1738@googlegroups.com> |
| In reply to | #41142 |
On Tuesday, 23 February 2016 02:53:35 UTC+2, Jerry Stuckle wrote: > On 2/22/2016 6:09 PM, Öö Tiib wrote: > > On Monday, 22 February 2016 23:58:17 UTC+2, Jerry Stuckle wrote: > >> On 2/22/2016 4:51 PM, Öö Tiib wrote: > >>> On Monday, 22 February 2016 23:19:07 UTC+2, Jerry Stuckle wrote: > >>>> On 2/22/2016 3:47 PM, Öö Tiib wrote: > >>>>> On Monday, 22 February 2016 22:16:28 UTC+2, Jerry Stuckle wrote: > >>>>>> On 2/22/2016 2:53 PM, Ian Collins wrote: > >>>>>>> Cholo Lennon wrote: > >>>>>>>> On 02/21/2016 10:44 PM, Jerry Stuckle wrote: > >>>>>>>>> On 2/21/2016 5:43 PM, Marcel Mueller wrote: > >>>>>>>>>> On 21.02.16 20.25, Jerry Stuckle wrote: > >>>>>>>>>>> > >>>>>>>>>>> "namespace" has existed for at least 25 years. I'm not sure exactly > >>>>>>>>>>> which standard had it first, but we were using it in the early 90's. > >>>>>>>>>> > >>>>>>>>>> All my complilers from the mid 90's can't deal with namespaces. Neither > >>>>>>>>>> Borland supported them nor IBM VAC++ and AFAIR gcc 2.9.5 did not > >>>>>>>>>> support > >>>>>>>>>> it either. > >>>>>>>>>> > >>>>>>>>> > >>>>>>>>> Sorry you had compilers which were not standards compliant. That does > >>>>>>>>> not mean it wasn't part of the standard. > >>>>>>>>> > >>>>>>>> > >>>>>>>> It's depends on what you define as C++ standard. Normally we tend to use > >>>>>>>> the ISO C++ as a reference (1998 or later). The ARM document (where > >>>>>>>> namespaces are described) is not considered "the" C++ standard. > >>>>>>> > >>>>>>> There weren't any standards compliant compilers in the early 90s because > >>>>>>> there wasn't a standard! > >>>>>>> > >>>>>> > >>>>>> Just because there wasn't an ISO standard at the time doesn't mean there > >>>>>> wasn't a standard. It started with Stroustrup's book. Modifications > >>>>>> followed from that. > >>>>>> > >>>>>> People think that ISO is the only organization which can issue > >>>>>> standards. Nothing is further from the truth. If they come out with a > >>>>>> standard, it is generally recognized world-wide. But when they haven't, > >>>>>> there can still be standards. > >>>>> > >>>>> Can you name the mysterious compiler? There was lot of talk of it but > >>>>> nothing supported it. First C++ that gave *warning* about usage of > >>>>> 'namespace' as variable name was CFront 3.0.3 released May 1994. It also > >>>>> did not yet have 'namespace' implemented, instead the README told that: > >>>>> > >>>>> The identifier names "mutable", "namespace", and "using" will > >>>>> now trigger a warning when they are used as identifiers. > >>>>> For example: > >>>>> > >>>>> int namespace = 37; > >>>>> > >>>>> This is because they are future keywords for the ANSI C++ language > >>>>> namespace feature. > >>>>> > >>>> > >>>> IBM's Visual C++ compiler for OS/2 and Windows did, for one. I don't > >>>> remember off hand what Linux compilers we used way back then. > >>> > >>> IBM VisualAge C++ added namespace support 2003 AFAIK, at 2000 it did > >>> have templates but no namespaces. > >>> > >> > >> VisualAge C++ for OS/2 and Windows didn't even exist in 2003. It had > >> been dropped several years before that. I don't remember exactly when, > >> though. > > > > OS/2 was long dead indeed but that VisualAge crap did still smoulder > > here and there. At 2000 its C++ certainly did not have namespaces. I trust > > it was 2011 when VisualAge was finally dropped and replaced with > > XL C/C++ by IBM. > > > >> > >>>> > >>>> And IIRC, even Microsoft Visual C++ 6.something supported them. But I > >>>> haven't used it for 15 years or more. > >>> > >>> Yes, I remember it, it had first nice IDE from MS and come shortly after > >>> first working OS from MS (NT 4.0). It was released in 1998. > >>> > >>> So how you could use those early nineties? > >>> > >> > >> Visual C++ came out long before 1998. > > > > Yes, looked it up https://support.microsoft.com/en-us/kb/145669 it > > seems that Visual C++ 4.00 were first that had namespaces (released at > > end of 1995). Borland C++ 5.0 released 1996 had also namespaces. So > > those were impossible to use in the early 90's without time machine. > > > > Yea, right. Just the response I would expect from an ignorant troll. > > <plonk!> How silly of you to spit poison there. Everybody do mistakes but those who insult others instead of admitting their error look desperate and pathetic.
[toc] | [prev] | [next] | [standalone]
| From | Robert Wessel <robertwessel2@yahoo.com> |
|---|---|
| Date | 2016-02-22 02:54 -0600 |
| Message-ID | <3vilcb11pjoctiqratscao5mcfhjjmu27c@4ax.com> |
| In reply to | #41085 |
On Sun, 21 Feb 2016 14:25:50 -0500, Jerry Stuckle <jstucklex@attglobal.net> wrote: >Wrong, wrong, wrong. All C compilers from the very beginning just >included whatever file was listed. > >#include <abc.xyz> > >would work if there was a file abc.xyz in the path. The *convention* at >the time was to have header files with an extension of .h. But it was >*never* a compiler requirement. That's at least partially incorrect. Early (pre-Unix System Services) C compilers for MVS would not, mainly because there was no way to specify an extension (including a ".H") on the actual source member being included. The ".H" would be dropped, and the file would be searched for from a list of (usually) PDS's defined in the search list (and usually two separate lists for system and user includes).
[toc] | [prev] | [next] | [standalone]
| From | "Alf P. Steinbach" <alf.p.steinbach+usenet@gmail.com> |
|---|---|
| Date | 2016-02-21 22:05 +0100 |
| Message-ID | <nad8m4$knj$1@dont-email.me> |
| In reply to | #41083 |
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>. In the same vein, the C++ header <string> is different from <cstring> and <string.h>. > I don't remember exactly when the new headers came. With the C++ standardization in 1998. >>> #ifdef __cplusplus >>> /* In C++ mode prefer class complex<> */ >>> #include <complex.h> >>> # define FFTW_DEFINE_COMPLEX(R, C) typedef complex<R> C >> >> This is wrong in two ways: >> >> • Include of `<complex.h>` >> It doesn't define the name used. Should be just `<complex>`. >> >> • Use of unqualified template `complex`. >> Should be `std::complex`. > > Earlier C++ compilers required exactly this syntax. No, they couldn't, because the C++ <complex> header, providing the `std::complex` class template, is an entirely different beast than the <ccomplex> and <complex.h> headers, which provide C style stuff. >> Conclusion so far is that FFTW3 is coded by programmers who make trivial >> errors all over the place – so that where it works, it probably works >> by happenchance. > > You should be careful and not blame the FFTW programmers for a patch > that is part of the application code. Well, then it's the application code programmers. ;-) That affects the conclusion about what to do, yes. > 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? Cheers & hth., - Alf
[toc] | [prev] | [next] | [standalone]
| From | bartekltg <bartekltg@gmail.com> |
|---|---|
| Date | 2016-02-23 10:55 +0100 |
| Message-ID | <nahaab$hpn$1@node1.news.atman.pl> |
| In reply to | #41090 |
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
[toc] | [prev] | [next] | [standalone]
| From | "Alf P. Steinbach" <alf.p.steinbach+usenet@gmail.com> |
|---|---|
| Date | 2016-02-23 19:45 +0100 |
| Message-ID | <nai964$1ol$1@dont-email.me> |
| In reply to | #41160 |
On 23.02.2016 10:55, bartekltg wrote: > 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 ;-) No. Not as far as I know. :) > "26.4.11 Header <ccomplex> [ccmplx] > 1 The header behaves as if it simply includes the header <complex>." Points to understand the above quote, which is of C++11 §26.4.10/1: • The header <ccomplex> is not the header <complex>. • The header <ccomplex> is the basic C++ variant of the /C header/ <complex.h>. It places the C declarations in namespace std. It may also place them in the global namespace. • The /C++ header/ <complex.h>, distinct from the C header <complex.h> (same name, yes), is defined in terms of <ccomplex> instead of directly in terms of the C header. The C++ header <complex.h> provides the same contents as <ccomplex> except that it provides this content in the global namespace. It may also provide the contents in the std namespace. And yes, I agree, the complexity of this is really ridiculous. The original C++98 idea was evidently to not-so-subtly-at-all encourage a move from “foo.h” headers to header names without filename extensions “cfoo”. At that time C++ <ccomplex> was not allowed to pollute the global namespace. But that did not sit well with compiler vendors, who saw no reason to jump through hoops with additional extreme complexity, with no evident advantage other than maybe supporting some idealistic notions about filenames, so with C++11 the rules were changed to make the <ccomplex> and <complex.h> requirements symmetric (and ditto for all other such header pairs), incidentally making the whole thing /meaningless/. So, just include <complex.h>, and forget about the <ccomplex> complexity, so to speak – but remember that this is the /C++ version/ of <complex.h>, and so it can, at the implementation's discretion, make code that uses std:: qualifications compile, even though that will not compile with some other compiler. :( Relevant: C++11 §17.6.1.2: <quote> Except as noted in Clauses 18 through 30 and Annex D, the contents of each header cname shall be the same as that of the corresponding header name.h, as specified in the C standard library (1.2) or the C Unicode TR, as appropriate, as if by inclusion. In the C ++ standard library, however, the declarations (except for names which are defined as macros in C) are within namespace scope (3.3.6) of the namespace std. It is unspecified whether these names are first declared within the global namespace scope and are then injected into namespace std by explicit using-declarations (7.3.3). </quote> > 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]. > " Yes. That compatibility is the whole point of the above wording. > [snip] > I think the problem is with libraries based on fortran (with C > interface). Then reinterpreted cast is needed, but at least > should work. Oh. I didn't think of that. Cheers!, - Alf
[toc] | [prev] | [next] | [standalone]
| From | "Alf P. Steinbach" <alf.p.steinbach+usenet@gmail.com> |
|---|---|
| Date | 2016-02-23 19:55 +0100 |
| Message-ID | <nai9p8$4bk$1@dont-email.me> |
| In reply to | #41173 |
Oh, please disregard that posting, I was not thinking clearly. There is no way there can be a C++ version of C99 <complex.h>, due to the C99 keyword _Complex. :( Cheers, - Alf On 23.02.2016 19:45, Alf P. Steinbach wrote: > On 23.02.2016 10:55, bartekltg wrote: >> 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 ;-) > > No. Not as far as I know. :) > > >> "26.4.11 Header <ccomplex> [ccmplx] >> 1 The header behaves as if it simply includes the header <complex>." > > Points to understand the above quote, which is of C++11 §26.4.10/1: > > • The header <ccomplex> is not the header <complex>. > > • The header <ccomplex> is the basic C++ variant of the /C header/ > <complex.h>. It places the C declarations in namespace std. It may also > place them in the global namespace. > > • The /C++ header/ <complex.h>, distinct from the C header <complex.h> > (same name, yes), is defined in terms of <ccomplex> instead of directly > in terms of the C header. The C++ header <complex.h> provides the same > contents as <ccomplex> except that it provides this content in the > global namespace. It may also provide the contents in the std namespace. > > And yes, I agree, the complexity of this is really ridiculous. The > original C++98 idea was evidently to not-so-subtly-at-all encourage a > move from “foo.h” headers to header names without filename extensions > “cfoo”. At that time C++ <ccomplex> was not allowed to pollute the > global namespace. But that did not sit well with compiler vendors, who > saw no reason to jump through hoops with additional extreme complexity, > with no evident advantage other than maybe supporting some idealistic > notions about filenames, so with C++11 the rules were changed to make > the <ccomplex> and <complex.h> requirements symmetric (and ditto for all > other such header pairs), incidentally making the whole thing > /meaningless/. So, just include <complex.h>, and forget about the > <ccomplex> complexity, so to speak – but remember that this is the > /C++ version/ of <complex.h>, and so it can, at the implementation's > discretion, make code that uses std:: qualifications compile, even > though that will not compile with some other compiler. :( > > Relevant: > > C++11 §17.6.1.2: > > <quote> > Except as noted in Clauses 18 through 30 and Annex D, the contents of > each header cname shall be the same as that of the corresponding header > name.h, as specified in the C standard library (1.2) or the C Unicode > TR, as appropriate, as if by inclusion. In the C ++ standard library, > however, the declarations (except for names which are defined as macros > in C) are within namespace scope (3.3.6) of the namespace std. It is > unspecified whether these names are first declared within the global > namespace scope and are then injected into namespace std by explicit > using-declarations (7.3.3). > </quote> > > >> 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]. >> " > > Yes. That compatibility is the whole point of the above wording. > > >> [snip] >> I think the problem is with libraries based on fortran (with C >> interface). Then reinterpreted cast is needed, but at least >> should work. > > Oh. I didn't think of that. > > > Cheers!, > > - Alf >
[toc] | [prev] | [next] | [standalone]
| From | bartekltg <bartekltg@gmail.com> |
|---|---|
| Date | 2016-02-23 20:41 +0100 |
| Message-ID | <naiclt$th0$1@node1.news.atman.pl> |
| In reply to | #41173 |
On 23.02.2016 19:45, Alf P. Steinbach wrote: > On 23.02.2016 10:55, bartekltg wrote: >> 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 ;-) > > No. Not as far as I know. :) In gcc 5.2.1, ccomplex: #pragma GCC system_header #ifndef _GLIBCXX_CCOMPLEX #define _GLIBCXX_CCOMPLEX 1 #if __cplusplus < 201103L # include <bits/c++0x_warning.h> #endif #include <complex> #endif It looks like, as stated in 26.4.11, including <ccomplex> has the same effect as including <complex>. Hmm. complex.h is... strange ;-) ... #if __cplusplus >= 201103L # include <ccomplex> #endif #if _GLIBCXX_HAVE_COMPLEX_H # include_next <complex.h> # ifdef _GLIBCXX_COMPLEX // See PR56111, keep the macro in C++03 if possible. # undef complex # endif #endif So it may be replaced by c++ <complex>. IMHO strange decision >> "26.4.11 Header <ccomplex> [ccmplx] >> 1 The header behaves as if it simply includes the header <complex>." > > Points to understand the above quote, which is of C++11 §26.4.10/1: Yes, I have looked at c++14 draft, in versions n3242.pdf n3376.pdf it is 26.4.10 > • The header <ccomplex> is not the header <complex>. Of course. This is a different file. The effect are the sama. > • The header <ccomplex> is the basic C++ variant of the /C header/ > <complex.h>. It places the C declarations in namespace std. It may also > place them in the global namespace. I'm lost. You just corrected me in which paragraph the standard say "The header behaves as if it simply includes the header <complex>.". > • The /C++ header/ <complex.h>, distinct from the C header <complex.h> > (same name, yes), is defined in terms of <ccomplex> instead of directly > in terms of the C header. The C++ header <complex.h> provides the same > contents as <ccomplex> except that it provides this content in the > global namespace. It may also provide the contents in the std namespace. > > And yes, I agree, the complexity of this is really ridiculous. The > original C++98 idea was evidently to not-so-subtly-at-all encourage a > move from “foo.h” headers to header names without filename extensions > “cfoo”. At that time C++ <ccomplex> was not allowed to pollute the > global namespace. But that did not sit well with compiler vendors, who > saw no reason to jump through hoops with additional extreme complexity, > with no evident advantage other than maybe supporting some idealistic > notions about filenames, so with C++11 the rules were changed to make > the <ccomplex> and <complex.h> requirements symmetric (and ditto for all > other such header pairs), incidentally making the whole thing > /meaningless/. So, just include <complex.h>, and forget about the > <ccomplex> complexity, so to speak – but remember that this is the > /C++ version/ of <complex.h>, and so it can, at the implementation's > discretion, make code that uses std:: qualifications compile, even > though that will not compile with some other compiler. :( Wow;-) > Relevant: > > C++11 §17.6.1.2: > > <quote> > Except as noted in Clauses 18 through 30 and Annex D, the contents of > each header cname shall be the same as that of the corresponding header > name.h, as specified in the C standard library (1.2) or the C Unicode > TR, as appropriate, as if by inclusion. In the C ++ standard library, > however, the declarations (except for names which are defined as macros > in C) are within namespace scope (3.3.6) of the namespace std. It is > unspecified whether these names are first declared within the global > namespace scope and are then injected into namespace std by explicit > using-declarations (7.3.3). > </quote> Does that mean complex.h and ccomplex (I have pasted fragments) from new gcc are broken according to the standard? best bartekltg
[toc] | [prev] | [next] | [standalone]
| From | "Alf P. Steinbach" <alf.p.steinbach+usenet@gmail.com> |
|---|---|
| Date | 2016-02-23 22:26 +0100 |
| Message-ID | <naiiki$k1m$1@dont-email.me> |
| In reply to | #41180 |
On 23.02.2016 20:41, bartekltg wrote:
>
> Does that mean complex.h and ccomplex (I have pasted fragments)
> from new gcc are broken according to the standard?
No, it means I posted some rubbish, sorry. Once I realized it, after a
second or two, I posted a follow-up to clarify that, but Usenet is a bit
asynchronous.
It would have been a good posting about C++03, and about the change of
the general rules in C++11, except that C++03 didn't have any <ccomplex>
or <complex.h> headers, only the C++ <complex> header.
C++03 provided the following C compatibility headers, based on C89:
<assert.h> <iso646.h> <setjmp.h> <stdio.h> <wchar.h>
<ctype.h> <limits.h> <signal.h> <stdlib.h> <wctype.h>
<errno.h> <locale.h> <stdarg.h> <string.h>
<float.h> <math.h> <stddef.h> <time.h>
*But*, with C++11 the C library compatibility was upgraded to track the
C evolution, so it was now specified in terms of C99 instead of C89/90.
And in C99 a new keyword was introduced, `_Complex`, used to form type
specifications that are just syntactically invalid when interpreted as
C++. Also a new header <complex.h> was introduced in C99, using those
C99 complex number types. With declarations like
double complex cacos(double complex);
where C99 `complex` is a macro required to be defined as `_Complex`, and
where this macro would wreak havoc with use of C++03's `complex`.
So, C++11 instead offers binary level compatibility for its `complex`
class template, in its new §26.4/4 which you quoted.
Anyway, coffee helps a little, and thanks for pointing out the new C++11
headers <ccomplex> and <complex.h>!
Since I learned something today I can pride myself on still not being
entirely senile, yay! :)
Cheers, & thanks,
- Alf
[toc] | [prev] | [next] | [standalone]
| From | Christian Gollwitzer <auriocus@gmx.de> |
|---|---|
| Date | 2016-02-22 08:16 +0100 |
| Message-ID | <naecec$a08$1@dont-email.me> |
| In reply to | #41081 |
Am 21.02.16 um 16:48 schrieb Alf P. Steinbach:
> On 21.02.2016 15:22, Marcel Mueller wrote:
>> Any suggestions, other than reworking all the old code for newer
>> standard compliance?
>
> I suggest switching to another FFT-library, one that works. :)
>
I'm not sure how serious you are with this suggestion. For one thing,
FFTW is /the/ FFT library, because it uses a superoptimization approach
to achieve very high performance. Especially if you need lengths which
are not powers of 2, FFTW is hard to beat.
Second, I haven't seen a library which does not define its own complex
numbers, because a long time in the C/C++ world complex numbers were not
supported overly well, as opposed to Fortran. Just a few weeks ago, we
found that neither gcc nor clang can vectorize loops with complex
numbers. All 3rd party libraries I know of use a
struct mycomplex { double real; double imag; }
It is nonsense to make these members private in <complex> with trivial
getters and setters. I have never seen an implementation which uses
polar coordinates or the like.
Christian
[toc] | [prev] | [next] | [standalone]
| From | Öö Tiib <ootiib@hot.ee> |
|---|---|
| Date | 2016-02-22 02:06 -0800 |
| Message-ID | <2091190b-8fb8-4172-975f-693ceef4cf6b@googlegroups.com> |
| In reply to | #41102 |
On Monday, 22 February 2016 09:16:37 UTC+2, Christian Gollwitzer wrote: > Am 21.02.16 um 16:48 schrieb Alf P. Steinbach: > > On 21.02.2016 15:22, Marcel Mueller wrote: > >> Any suggestions, other than reworking all the old code for newer > >> standard compliance? > > > > I suggest switching to another FFT-library, one that works. :) > > > > I'm not sure how serious you are with this suggestion. Smiley indicates that it was not serious suggestion. Serious suggestion (that you snipped) seemed to be to fix FFTW and to submit a patch to it.
[toc] | [prev] | [next] | [standalone]
| From | Ian Collins <ian-news@hotmail.com> |
|---|---|
| Date | 2016-02-22 09:00 +1300 |
| Message-ID | <diujaoFj7j6U5@mid.individual.net> |
| In reply to | #41080 |
Marcel Mueller wrote: > I have some compatibility issues regarding complex.h in an FFTW3 > application. > > 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> > This is deprecated but so far all relevant compilers supported the old > header files for compatibility. The code is quite old (~15 years) and > not namespace aware. I only upgraded to FFTW3 several years ago. > > But now I try to switch to a newer compiler (gcc 4.8) and this raises a > conflict with the C99 compatibility header complex.h. Of course, this > does not support the resulting type definition in fftw3.h (compiled with -E) > typedef __complex__<long double> fftwl_complex; > > The fftw3.h behaves differently when included from C++. This is an > application specific patch. > > #ifdef __cplusplus > /* In C++ mode prefer class complex<> */ > #include <complex.h> > # define FFTW_DEFINE_COMPLEX(R, C) typedef complex<R> C What happens if you change these two lines to: #include <complex> # define FFTW_DEFINE_COMPLEX(R, C) typedef std::complex<R> C or # define FFTW_DEFINE_COMPLEX(R, C) using C = std::complex<R> if you are using C++ >= 11. ? -- Ian Collins
[toc] | [prev] | [next] | [standalone]
| From | Marcel Mueller <news.5.maazl@spamgourmet.org> |
|---|---|
| Date | 2016-02-21 23:51 +0100 |
| Message-ID | <nadf1k$ane$1@gwaiyur.mb-net.net> |
| In reply to | #41087 |
On 21.02.16 21.00, Ian Collins wrote: > What happens if you change these two lines to: > > #include <complex> > # define FFTW_DEFINE_COMPLEX(R, C) typedef std::complex<R> C This might work. I have to test it. I have to check whether the code references the type complex<> directly somewhere else. If it works it is the best solution so far. > or > > # define FFTW_DEFINE_COMPLEX(R, C) using C = std::complex<R> > > if you are using C++ >= 11. No, I should not depend on C++11. Currently gcc from 3.3.5 and up is supported. C++11 requires 4.8, which has only experimental support on the target platform. By the way, what is the difference between typedef and using in this context? Marcel
[toc] | [prev] | [next] | [standalone]
| From | Öö Tiib <ootiib@hot.ee> |
|---|---|
| Date | 2016-02-21 15:41 -0800 |
| Message-ID | <7633a98c-51ed-4c0c-b9be-6636bc2e1895@googlegroups.com> |
| In reply to | #41095 |
On Monday, 22 February 2016 00:51:43 UTC+2, Marcel Mueller wrote:
> On 21.02.16 21.00, Ian Collins wrote:
> > What happens if you change these two lines to:
> >
> > #include <complex>
> > # define FFTW_DEFINE_COMPLEX(R, C) typedef std::complex<R> C
>
> This might work. I have to test it. I have to check whether the code
> references the type complex<> directly somewhere else.
> If it works it is the best solution so far.
>
> > or
> >
> > # define FFTW_DEFINE_COMPLEX(R, C) using C = std::complex<R>
> >
> > if you are using C++ >= 11.
>
> No, I should not depend on C++11. Currently gcc from 3.3.5 and up is
> supported. C++11 requires 4.8, which has only experimental support on
> the target platform.
>
> By the way, what is the difference between typedef and using in this
> context?
No differences in that context. (7.1.3.2): ... It has the same semantics
as if it were introduced by the typedef specifier. ...
Lot of programmers prefer 'using' because alias declaration is superset
of 'typedef' specifier and it is considered easier to read.
typedef void meh_t();
using doh_t = void();
static_assert(std::is_same<meh_t,doh_t>(), "should be no difference");
[toc] | [prev] | [next] | [standalone]
| From | "Alf P. Steinbach" <alf.p.steinbach+usenet@gmail.com> |
|---|---|
| Date | 2016-02-22 00:50 +0100 |
| Message-ID | <nadia9$d39$1@dont-email.me> |
| In reply to | #41095 |
On 21.02.2016 23:51, Marcel Mueller wrote: > On 21.02.16 21.00, Ian Collins wrote: >> What happens if you change these two lines to: >> >> #include <complex> >> # define FFTW_DEFINE_COMPLEX(R, C) typedef std::complex<R> C > > This might work. I have to test it. I have to check whether the code > references the type complex<> directly somewhere else. > If it works it is the best solution so far. Such a direct technical fix can appear to be best, but when I offered this purely technical solution in the first follow up to your posting (Ian's presentation of what to write nicely complemented my earlier explanation of what to fix and how – I forgot to make that concrete!), > • Include of `<complex.h>` > It doesn't define the name used. Should be just `<complex>`. > > • Use of unqualified template `complex`. > Should be `std::complex`. … I went on to mention some higher level solutions. These solutions include ditching the current approach, and at an even higher level, they include considering whether the driving constraints for the problem, e.g. support for early 1990's compilers, stem from e.g. a sociopolitical issue, or really a purely technical issue. > [snip] > By the way, what is the difference between typedef and using in this > context? Only clarity of notation. Which I think is important. ;-) Cheers & hth., - Alf
[toc] | [prev] | [standalone]
Page 2 of 2 — ← Prev page 1 [2]
Back to top | Article view | comp.lang.c++
csiph-web