Re: value not set via reference

2015-01-29 Thread James Dennett
On Thu, Jan 29, 2015 at 10:38 PM, Conrad S wrote: > > Which compiler is correct here - gcc or clang? Both compilers are correct. > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64870 > > Consider the following code: > > #include > > struct blah { > inline double setval(unsigned int& x) const >

Re: help understanding behaviour of unsuffixed float constants

2014-05-22 Thread James Dennett
On Thu, May 22, 2014 at 12:36 PM, Regan, Brian (EPC COE) wrote: > Don't misunderstand - I like the behaviour. I don't want the unnecessary > implicit conversions). > > My concern stems only from the compliance to the standard. Some of our > internal software standards require ISO99 compliance, a

Re: std::count leaked outside namespace std?

2013-04-24 Thread James Dennett
On Wed, Apr 24, 2013 at 5:25 AM, Nathan Ridge wrote: >> Here's a simple program: >> >> #include >> #include >> >> int main() >> { >> std::vector vec; >> count(vec.begin(), vec.end(), 0); // shouldn't this be std::count ? >> } >> >> The above compiles successfully, but I think it shouldn't. I exp

Re: g++ member function .at() for arrays

2013-03-08 Thread James Dennett
On Fri, Mar 8, 2013 at 12:42 AM, Robin Whittle wrote: > I am a newbie to this list. Thanks for GCC, g++ the C++ standard > library and GDB! Apologies in advance if I have missed a web page where > this question is answered. Perhaps this question belongs on the > libstdc++ list. It doesn't belo

Re: hard typdef - proposal - I know it's not in the standard

2013-01-27 Thread James Dennett
On Sun, Jan 27, 2013 at 6:19 PM, Alec Teal wrote: > To some up again (I've kept the quotes so it can be seen what's already been > talked about) I propose something that is almost identical to a typedef as > it exists now, all behaviour of this hard typedef is almost identical > except: > > 1) the

Re: a hello, and a few gcc v4+ implementation questions

2013-01-03 Thread James Dennett
On Thu, Jan 3, 2013 at 2:50 AM, Mayuresh Kathe wrote: > Hello, I've just joined the list as I've returned to the GNU world after > almost 9 years. > Feels good to be back. :) > > I've been reading up on GCC through various articles online and have > come to understand that GCC now is being written

Re: Request for comments on language extension: Safe arrays and pointers for C.

2012-09-01 Thread James Dennett
On Sat, Sep 1, 2012 at 8:35 PM, John Nagle wrote: > On 9/1/2012 9:59 AM, James Dennett wrote: >> On Fri, Aug 31, 2012 at 2:55 PM, John Nagle >> wrote: >>> We have proposed an extension to C (primarily) and C++ (possibly) >>> to address buffer overflow preven

Re: Request for comments on language extension: Safe arrays and pointers for C.

2012-09-01 Thread James Dennett
On Fri, Aug 31, 2012 at 2:55 PM, John Nagle wrote: >We have proposed an extension to C (primarily) and C++ (possibly) > to address buffer overflow prevention. Buffer overflows are still > a huge practical problem in C, and much important code is still > written in C. This is a new approach t

Re: Add corollary extension

2012-06-28 Thread James Dennett
On Thu, Jun 28, 2012 at 3:08 PM, Rick C. Hodgin wrote: > How would you handle: > > isSystemClosed = true; A good clean error message is ideal, and should be easy. (A proxy object such as inv_bool can do this easily enough, but it's still going to hurt readability.) > You're getting into nasty

Re: Add corollary extension

2012-06-28 Thread James Dennett
On Thu, Jun 28, 2012 at 12:39 PM, Rick Hodgin wrote: >> Why do you want to bother with a non-standard, >> unportable extension instead of just writing: >> >> inline bool isSystemClosed() >> { return !isSystemOpen; } >> >> Which is simple, conventional, easy to understand >> and portable. >> >> Or

Re: gcc 4.3.x: Bug in ieee754-{df,sf}.S

2012-05-14 Thread James Dennett
On Mon, May 14, 2012 at 1:36 PM, Sven Köhler wrote: > Hi, > > currently, our software (www.lejos.org, build with a gcc 4.3.x based > arm-elf toolchain) manages to compare floats correctly most of the time. > But sometimes, the comparisons don't have the expected result. > Basically, comparisons be

Re: Switching to C++ by default in 4.8

2012-04-11 Thread James Dennett
On Wed, Apr 11, 2012 at 11:11 PM, Miles Bader wrote: > Ian Lance Taylor writes: >>> And GCC usually has better diagnostic than clang except in those few >>> areas which it does not (those some might say those areas are the most >>> important ones). >> >> No.  clang's diagnostics for C++ are much

Re: Support for export keyword to use with C++ templates ?

2012-03-10 Thread James Dennett
On Sat, Mar 10, 2012 at 6:35 AM, Timothy Madden wrote: > On 25.01.2010 20:12, Ian Lance Taylor wrote: >> >> Timothy Madden  writes: > > [...] > >> >> g++ is free software.  A clean implementation of export would >> certainly be accepted.  All it takes is for somebody to write one. > > > Hello > >

Re: Size of enum‏

2012-02-05 Thread James Dennett
On Sun, Feb 5, 2012 at 12:58 PM, Jonathan Wakely wrote: > 2012/2/5 David Brown : >> >> Enum types in C++ can be any integer type big enough to cover the required >> range.  I think most C++ compilers use the smallest integer type that covers >> the range. > > With the three C++ compilers I tried e

Re: Dealing with compilers that pretend to be GCC

2012-01-20 Thread James Dennett
On Fri, Jan 20, 2012 at 2:41 PM, Cary Coutant wrote: >> Yeah, but it’s a shame that those compilers define __GNUC__ without >> supporting 100% of the GNU C extensions.  With this approach, you would >> also need to add !defined for Clang, PGI, and probably others. > > Having worked on the other si

Re: a nifty feature for c preprocessor

2011-12-29 Thread James Dennett
On Thu, Dec 29, 2011 at 1:50 PM, David Brown wrote: > On 29/12/11 22:05, R A wrote: >> >> >>> The gcc developers, and everyone else involved in the development >>> of C as a language, are perhaps not superhuman - but I suspect >>> their combined knowledge, experience and programming ability >>> ou

Re: Need to correct the function declaration.

2011-11-06 Thread James Dennett
On Sun, Nov 6, 2011 at 6:55 PM, niXman wrote: > When I try to build gcc-trunk on OpenBSD-5.0(gcc-4.2.1), I get the > following error: >> gcc-4.6.2/i686-pc-openbsd5.0/libstdc++-v3/include/mutex:818:64: error: >>   invalid conversion from 'void (*)(...)' to 'void (*)()' [-fpermissive] > > Please add

Re: should sync builtins be full optimization barriers?

2011-09-26 Thread James Dennett
On Mon, Sep 26, 2011 at 9:57 AM, Andrew MacLeod wrote: >> Hi, >> >> On Tue, 13 Sep 2011, Andrew MacLeod wrote: >> >>> Your example was not about regular stores, it used atomic variables. >> >> This reads as if there exists non-atomic variables in the new C++ >> mem-model.  Assuming that this is so

Re: C++11 no longer experimental

2011-09-21 Thread James Dennett
On Wed, Sep 21, 2011 at 10:51 AM, Nathan Ridge wrote: > > Hello, > > Now that the C++11 standard has been officially voted in, there is nothing >  "experimental" about it any more. > > Would it be possible to remove the warning about GCC's C++11 support > being experimental from http://gcc.gnu.org

Re: C99 Status - inttypes.h

2011-07-22 Thread James Dennett
On Fri, Jul 22, 2011 at 8:37 AM, Paulo J. Matos wrote: > On 22/07/11 16:22, Joern Rennecke wrote: >>> >>> I have to disagree, library issue means that it's an issue with the >>> library, not gcc. >> >> It still makes sense to clarify the language to indicate that, depending >> on >> the library us

Re: [C++-0X] User-defined literals, gsoc

2011-03-29 Thread James Dennett
On Tue, Mar 29, 2011 at 2:16 PM, Ed Smith-Rowland <3dw...@verizon.net> wrote: > On 03/29/2011 10:05 AM, Levon Haykazyan wrote: >> >> Hi Ed, >> >> I am working on a proposal to implement user-defined literals as a Google >> Summer of Code project. I was unaware that someone was already working on >>

Re: [C++0x] Range-based for statements and ADL

2011-03-25 Thread James Dennett
On Fri, Mar 25, 2011 at 11:13 AM, Rodrigo Rivas wrote: > On Wed, Mar 23, 2011 at 5:46 PM, Jason Merrill wrote: >> Yep.  Here is the wording that we approved today: > [snip] > > Nice. Thank you. > But now I'm a bit concerned about the complexity of this issue. Mind > me, I think that this solution

Re: [c++0x] cannot return a constant

2010-11-30 Thread James Dennett
On Tue, Nov 30, 2010 at 12:53 PM, Roman Kononov wrote: > 2010-11-30 20:40 CST, Jonathan Wakely said: >>However, that doesn't change the fact you're trying to move from a >>const object, which is obviously wrong. > > Not really, because the 2 const objects are about to be destroyed. The fact that

Re: std::move() does not move a constant of a class type

2010-11-27 Thread James Dennett
On Sat, Nov 27, 2010 at 4:13 PM, Roman Kononov wrote: > Hello, > > Is it a bug or am I missing something? > > $ cat test.cpp > #include > > struct X { >   X()=default; >   X(X&&)=default; > }; > > X test() { >   X const a={}; >   return std::move(a); > } > > $ g++ -c -std=c++0x test.cpp > test.cp

Re: g++ segfault when using C++0x feature‏

2010-09-07 Thread James Dennett
2010/9/7 Nathan Ridge : > > Hello, > > The attached minimal code (test.cpp) causes g++ to > segfault. It uses the C++0x features variadic templates and initializer > lists. > > The command used to compile it is: > > g++ -std=c++0x test.cpp > > The output is: > > test.cpp: In function ‘void f(const

Re: x86 assembler syntax

2010-08-15 Thread James Dennett
On Sun, Aug 15, 2010 at 2:44 PM, Gerald Pfeifer wrote: > Hi Rick (and others), > > On Thu, 12 Aug 2010, Rick C. Hodgin wrote: >>> This question would have been more appropriate on the gcc-help mailing >>> list. -Ian Lance Taylor >> My apologies to everyone.  I did not know such a list existed. > >

Re: GCC 4.5.0 Reports invalid warning

2010-07-15 Thread James Dennett
On Thu, Jul 15, 2010 at 5:31 PM, J Decker wrote: > Oh not so bad then, I can just add at the beginning... > > typedef struct a *NeverUsedDefinition; > > and now it's happy?  And that makes good coding how? If I never > actually use 'NeverUsedDefinition'?  Actually this 'feature' now > causes usele

Re: The future of concepts

2009-07-28 Thread James Dennett
On Tue, Jul 28, 2009 at 3:01 AM, Piotr Wyderski wrote: > Concepts have recently been removed from the C++0x Standard Draft. > Will the concepts branch be discontinued? I hope not. Concepts will be "finished" and re-added to C++, and it would be immensely helpful in that effort if there were a ver

Re: Should -Wjump-misses-init be in -Wall?

2009-06-20 Thread James Dennett
On Sat, Jun 20, 2009 at 6:57 AM, H.J. Lu wrote: > On Sat, Jun 20, 2009 at 6:50 AM, James Dennett wrote: > >>> I think it is a bad idea to include it in -Wall. You fixed 3 warnings in >>> gcc and I fixed 1 in binutils. If you have thousands of packages in C, >>&g

Re: Should -Wjump-misses-init be in -Wall?

2009-06-20 Thread James Dennett
On Sat, Jun 20, 2009 at 6:17 AM, H.J. Lu wrote: > On Sat, Jun 20, 2009 at 12:04 AM, Ian Lance Taylor wrote: >> Ralf Wildenhues writes: >> >>> * Ian Lance Taylor wrote on Sat, Jun 20, 2009 at 07:12:50AM CEST: Any opinions on this?  Should I take the new warning out of -Wall? >>> >>> Is the mis

Re: (extern int vs. int) and (extern function vs. function) (was: gcc-in-cxx update)

2009-04-30 Thread James Dennett
On Thu, Apr 30, 2009 at 11:57 AM, Ian Lance Taylor wrote: > Eus writes: > >> I think the difference between "int i;" and "extern int i;" at >> file-scope in C is that "int i;" will only be treated as a definition if >> it is not defined in another place in the same file/TU. IOW, its linkage >> is

Re: GCC 4.5: "nonconstant array index in initializer" error

2009-04-23 Thread James Dennett
gt; } >> > >> > >> > command line is: gcc test.c >> > >> > GCC 4.5.0 revision 146607 compiles this code with following errors: >> > test.c:5: error: nonconstant array index in initializer >> > test.c:5: error: (near initialization for 'arr&

Re: GCC 4.5: "nonconstant array index in initializer" error

2009-04-23 Thread James Dennett
On Thu, Apr 23, 2009 at 1:38 PM, Denis Onischenko wrote: > The minimal code example is following: > > > extern unsigned int __invalid_size_argument; > #define TYPECHECK(t)    ( sizeof(t) == sizeof(t[1]) ?  sizeof(t) : > __invalid_size_argument ) > > static int arr[] = { >        [TYPECHECK(int)] =

Re: vector<> issue in g++?

2009-04-20 Thread James Dennett
On Sun, Apr 19, 2009 at 7:19 PM, James Dennett wrote: > On Sun, Apr 19, 2009 at 4:15 PM, Paolo Piacentini > wrote: >> I don't think this is a bug but certainly it is a problem. >> >> Would you please consider it and let me know? I hope so. Thanks. >> >&

Re: GCC 4.3.2 bug (was: Illegal subtraction in tmp-dive_1.s)‏

2009-04-20 Thread James Dennett
2009/4/19 Jason Mancini : > >> Vincent Lefevre  writes: >>    while ((*(q++))-- == 0) ; > > Is that defined and legal??  Is q incremented before or after *q is > decremented?  They are both post operators! > Jason Mancini It's defined and legal (so long as q != &q, which might well be guaranteed

Re: vector<> issue in g++?

2009-04-19 Thread James Dennett
On Sun, Apr 19, 2009 at 4:15 PM, Paolo Piacentini wrote: > I don't think this is a bug but certainly it is a problem. > > Would you please consider it and let me know? I hope so. Thanks. > > The following simple volcalc.cpp code compiles with no errors (and > works) in Windows Visual C++. > It sim

Re: Diagnostic Messaging Suggestion

2009-04-16 Thread James Dennett
On Thu, Apr 16, 2009 at 12:06 PM, Arthur Schwarz wrote: > > > > Suggested Messaging: Messaging seems redundant in indicating that function > has been redifined twice. One of the messages should be removed. More to the > point, I think the messaging may be erroneous - code fragment follows. > > >

Re: messaging

2009-04-14 Thread James Dennett
On Tue, Apr 14, 2009 at 9:21 AM, wrote: > > Thanks Kai. I do have what I hope is a more specific subjective reason for > saying that I think the existing diagnostics should be changed. > Fundamentally, what is provided in the messaging is not an indication of what > is wrong, but an indication

Re: missing return statement

2009-03-12 Thread James Dennett
On Thu, Mar 12, 2009 at 11:29 PM, Dave Korn wrote: > James Dennett wrote: >> On Thu, Mar 12, 2009 at 4:56 PM, Robert Dewar wrote: >>> Nathan Ridge wrote: >>> >>>> Why does gcc not give an error about this? >>>> If I compile with "-Wall"

Re: missing return statement

2009-03-12 Thread James Dennett
On Thu, Mar 12, 2009 at 4:56 PM, Robert Dewar wrote: > Nathan Ridge wrote: > >> Why does gcc not give an error about this? >> If I compile with "-Wall", it will give a WARNING saying >> "control reaches end of non-void function". >>  However, shouldn't it be an ERROR to return nothing >> from a fu

Re: Is a Better Warning for this Stupid Mistake?

2009-02-25 Thread James Dennett
On Wed, Feb 25, 2009 at 9:56 AM, Joel Sherrill wrote: > Hi, > > I made a stupid typo and accidentally included > an unprotected file from itself.  The error > message generated by gcc surprised me and I > wondered if there was a better alternative. > > $ cat recursive_include.c > #include "recursi

Re: Serious code generation/optimisation bug (I think)

2009-01-27 Thread James Dennett
On Mon, Jan 26, 2009 at 11:52 PM, wrote: > I was debugging a function and by inserting the debug statement crashed > the system. Some investigation revealed that gcc 4.3.2 arm-eabi (compiled > from sources) with -O2 under some circumstances assumes that if a pointer > is dereferenced, it can not

Re: Experimental C++0x Language Support: new for loop?

2008-12-15 Thread James Dennett
On Mon, Dec 15, 2008 at 1:40 PM, Dave Steffen wrote: > Hi Folks > > I'm looking at the "C++0x Language Support in GCC" page > (http://gcc.gnu.org/projects/cxx0x.html) with anticipation. One thing > I *don't* see listed at all is status for the new for-loop (paper > N2778 I believe). Is this an o

Re: bug in GCC or C++ standard ?

2008-11-12 Thread James Dennett
On Wed, Nov 12, 2008 at 11:29 AM, Joe Buck <[EMAIL PROTECTED]> wrote: > On Tue, Nov 11, 2008 at 08:43:40PM -0800, James Dennett wrote: >> (There are secondary uses of unions for type punning. Most such uses >> are not valid portable C++, but g++ supports them because they&#x

Re: bug in GCC or C++ standard ?

2008-11-11 Thread James Dennett
On Tue, Nov 11, 2008 at 8:04 PM, Mark Tall <[EMAIL PROTECTED]> wrote: > On 12/11/2008, James Dennett <[EMAIL PROTECTED]> wrote: >> In a union only one field can be active at one time, hence >> initializing more than one makes no sense >> ... >> However, co

Re: bug in GCC or C++ standard ?

2008-11-11 Thread James Dennett
On Tue, Nov 11, 2008 at 6:53 PM, Mark Tall <[EMAIL PROTECTED]> wrote: > Hello, > > I've come across an oddity in C++, involving anonymous unions and > const variables. Neither of the two classes below will compile using > gcc 4.3.0. Is this a bug in gcc or the C++ standard itself ? No... > class

Re: GCC bug when using typeof

2008-10-21 Thread James Dennett
On Tue, Oct 21, 2008 at 9:32 AM, Joe Buck <[EMAIL PROTECTED]> wrote: > On Mon, Oct 20, 2008 at 07:21:49PM -0700, Andrew Pinski wrote: >> On Mon, Oct 20, 2008 at 7:19 PM, Peng Yu <[EMAIL PROTECTED]> wrote: >> > Could you please help explain what the difference between typeof and >> > decltype are? W

Re: Compiler error w/ templates and default argument value

2008-10-10 Thread James Dennett
2008/10/10 Peter A. Felvegi <[EMAIL PROTECTED]> > > Hello All, > > I've run into this: > > 8<8<8< > template > class B > { > protected: >static const int i = 42; > }; > > template > class D : protected B > { > public: >D(int n_ = B::i); // line 12 > }; > 8<8<

Re: Possible bug in preprocessor

2007-03-30 Thread James Dennett
JoseD wrote: > Hi. Just wanted to share that the following macro gives an error on latest > versions of GCC, but is reported to work on 2.95.3 (tested on MorphOS but > should be the same for other OSses of course). > Both an old version of SASC(AmigaOS) and Borland (on X86) worked fine. > > #inclu

Re: Signed int overflow behavior in the security context

2007-01-29 Thread James Dennett
Paul Schlie wrote: >> Joseph Myers wrote: >> DR#260 seems clear enough that indeterminate values may be treated >> distinctly from determinate values including randomly changing at any >> time. > > One can only hope that the recommendati

Re: Signed int overflow behavior in the security context

2007-01-29 Thread James Dennett
Joseph S. Myers wrote: > On Sun, 28 Jan 2007, James Dennett wrote: > >> Therefore, a case can be made that *for an implementation >> in which a type has no trap values*, an indeterminate >> value must correspond to some specific value. In other >> words: reading an

Re: Signed int overflow behavior in the security context

2007-01-28 Thread James Dennett
Paul Schlie wrote: >> Paul Jarc wrote: >>> Paul Schlie <[EMAIL PROTECTED]> wrote: >>> x = x ; perfectly fine; as lvaue x clearly designates an object (no trap) >> Can you cite the part of the standard that says that? The fact that >> an expression designates an object does not exclude that object

Re: Signed int overflow behavior in the security context

2007-01-28 Thread James Dennett
Paul Schlie wrote: >> Paul Jarc wrote: >>> Paul Schlie wrote: >>> if it has an indeterminate value [...] has no bearing on an rvalue >>> access to a well defined storage location >> You might think so, but that's actually not true in the C standard's >> terminology. It sounds like you interpret "i

Re: Signed int overflow behavior in the security context

2007-01-27 Thread James Dennett
Paul Schlie wrote: >> Brooks Moses wrote: >> ... >> Does that logic work for you? > > no, as although a variable's value may not have been previously defined > within the context of a particular program, a variable's access semantics > are orthogon

Re: Signed int overflow behaviour in the security context

2007-01-23 Thread James Dennett
Richard Kenner wrote: >> Oh, and teaching all of the programmers out there all the subtle nuances >> of C and trying to get them to write proper code: good luck. That >> simply won't happen. > > If people who write security-critical code in a programming language > can't take time to learn the de

Re: Good book on C? http://publications.gbdirect.co.uk/c_book/

2007-01-19 Thread James Dennett
Richard Stallman wrote: > http://publications.gbdirect.co.uk/c_book/ is reportedly a free > book on C -- but it is C89, more or less. > > If it is well written, we could look for people to update it to modern > C. But if it isn't well written and clear, it probably isn't worth > the trouble. > >

Re: compile time enforcement of exception specification

2007-01-14 Thread James Dennett
Bob Rossi wrote: > On Sun, Jan 14, 2007 at 12:16:32AM -0500, Andrew Pinski wrote: >>> Hi, >>> >>> Will g++ ever add a compile time enforcement of the exception >>> specification like the Java compiler does? >>> >>> I find the exception specification almost useless with out this >>> functionality. >

Re: Making gcc read from the standard input

2007-01-11 Thread James Dennett
Paolo Bonzini wrote: > Tathagato Rai Dastidar wrote: >> Hello, >> >> Is there a way I can make GCC read a C or C++ code from the standard >> input instead of from a file? >> >> In my application software, I am generating some C code on the fly, >> writing it to a file, then using GCC to compile it.

Re: How can I interface myself with the C preprocessor?

2006-10-05 Thread James Dennett
Michael Eager wrote: Matteo Fioroni wrote: Thanks for your help, I saw the gcc -E output: but it don't match my needs. I've to interface the Preprocessor to get the tokens (keyword, preprocessor directives, grammar, ecc..) it analyzes on which I've to permorm some operations. The preprocessor