This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [C++0x patch] implement range-based for loops


On Tue, Sep 07, 2010 at 02:39:46PM +0200, Rodrigo Rivas wrote:
>   range_temp = build_decl (input_location, VAR_DECL,
>                            get_identifier ("__range"), range_type);
>   TREE_USED (range_temp) = 1;
>   DECL_ARTIFICIAL (range_temp) = 1;
>   pushdecl (range_temp);
> 
> And so on. Now I can see it in the debugger, but I can also use these
> names in the code. This makes it, effectively, a GNU extension, even
> with "-std=c++0x". I don't know... being able to debug it is nice, but
> to allow the user to use a non-standard feature for not real gain may
> be problematic. Is it possible to prevent the user from using the
> names while allowing the debugger to see them?

The __ prefixed identifiers are reserved for implementation, so they
shouldn't be used in arbitrary C++ code.  On the other side, they can
be used in libstdc++ or libc headers, and they are
used quite heavily in both libstdc++ and libc headers (__range just
in libc headers, __start in both libstdc++ and libc headers, __end just
in libstdc++ headers).
So perhaps __for_range, __for_start, __for_end or something similar
would be better.

	Jakub


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]