[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Problem with Sun Studio 12 C++
From: |
Ralf Wildenhues |
Subject: |
Re: Problem with Sun Studio 12 C++ |
Date: |
Mon, 9 Mar 2009 19:28:24 +0100 |
User-agent: |
Mutt/1.5.18 (2008-05-17) |
* Eric Blake wrote on Sun, Mar 08, 2009 at 03:48:40PM CET:
> According to Ralf Wildenhues on 3/8/2009 4:21 AM:
> > I think the Autoconf testsuite deserves to detect this issue,
> > lest it happen again. How about this patch?
>
> I like it. Fix the nits, then apply.
Done; thanks.
> > The cpp-works stuff is necessary for systems without a working C++
> > compiler. AC_PROG_CXX sets CXX to g++ in that case. We should find
> > out why that was done, and fix it.
>
> Didn't libtool already have to hack around that fact? Yes, it would be
> nice to make autoconf more honest when CXX cannot be found, but as a
> separate patch.
yes and yes and yes.
> > +int foo (int * restrict ip)
> > +{
> > + return ip[0];
> > +}
>
> If I understand restrict correctly (although I'm not entirely sure I do),
> it does not make sense to use restrict unless there are at least two
> pointers in play, because you can't have aliasing without multiple
> references. While I don't think the language forbids a single parameter
> with restrict, I also think that it may be better to write this as:
>
> int foo (int * restrict i1, int * restrict i2)
> {
> return i1[0] + i2[0];
> }
Sure, why not. I simply took the test from AC_C_RESTRICT itself, which
uses only one argument, too. It doesn't really matter here, as the
compiler will typically barf with a syntax error if the restrict keyword
(whatever it's #define'd to) is not understood.
Cheers,
Ralf