Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > Request for build feedback

Reply
Thread Tools

Request for build feedback

 
 
woodbrian77@gmail.com
Guest
Posts: n/a
 
      08-26-2013
On Monday, August 26, 2013 3:52:47 PM UTC-5, Barry Schwarz wrote:

>
> When the compiler is parsing the source into tokens, it is required to
> go as far as possible (an approach called maximum munch). The
> compiler must include the next character in the current token if doing
> results in a valid token. The classic example is
>
> a = b+++c;
>
> The compiler is required to process this as
>
> a = b++ + c;
>
> and not
>
> a = b + ++c;
>
>


What about templates and > ?
It's not required to have a space between >'s
in 2011 C++:

::std::deque<::std::deque<int>> hi;

That seems to be an exception to maximal munching.
 
Reply With Quote
 
 
 
 
Victor Bazarov
Guest
Posts: n/a
 
      08-26-2013
On 8/26/2013 5:30 PM, http://www.velocityreviews.com/forums/(E-Mail Removed) wrote:
> On Monday, August 26, 2013 3:52:47 PM UTC-5, Barry Schwarz wrote:
>
>>
>> When the compiler is parsing the source into tokens, it is required to
>> go as far as possible (an approach called maximum munch). The
>> compiler must include the next character in the current token if doing
>> results in a valid token. The classic example is
>>
>> a = b+++c;
>>
>> The compiler is required to process this as
>>
>> a = b++ + c;
>>
>> and not
>>
>> a = b + ++c;
>>
>>

>
> What about templates and > ?
> It's not required to have a space between >'s
> in 2011 C++:
>
> ::std::deque<::std::deque<int>> hi;
>
> That seems to be an exception to maximal munching.


Why? No exception. It eats both > symbols as a single token and then
the compilation allows using it to close two opening angle brackets at
the same time. Of course if you had a template

template<int i> struct myT { bool operator >(int) const; };

you can't write

int i;
myT<42>> i;

because the >> is interpreted as a double closing bracket and not as two
separate tokens: one closing bracket and one operator greater-than sign.
Probably. I didn't try it.

V
--
I do not respond to top-posted replies, please don't ask
 
Reply With Quote
 
 
 
 
woodbrian77@gmail.com
Guest
Posts: n/a
 
      08-26-2013
On Monday, August 26, 2013 4:19:04 PM UTC-5, Ian Collins wrote:
>
> There shouldn't be another namespace called std.
>


That and $5 will get you a cup of coffee.
 
Reply With Quote
 
woodbrian77@gmail.com
Guest
Posts: n/a
 
      08-26-2013
On Monday, August 26, 2013 4:41:07 PM UTC-5, (E-Mail Removed) wrote:
> On Monday, August 26, 2013 4:19:04 PM UTC-5, Ian Collins wrote:
> >

>
> > There shouldn't be another namespace called std.
> >

>
> That and $5 will get you a cup of coffee.


There shouldn't be drunks driving around either. It is
defensive programming.
 
Reply With Quote
 
Ike Naar
Guest
Posts: n/a
 
      08-26-2013
On 2013-08-26, (E-Mail Removed) <(E-Mail Removed)> wrote:
> On Monday, August 26, 2013 4:19:04 PM UTC-5, Ian Collins wrote:
>>
>> There shouldn't be another namespace called std.

>
> That and $5 will get you a cup of coffee.


You are using ::std (instead of plain std) in contexts where there
is no way that another std namespace than the global one can apply.
 
Reply With Quote
 
woodbrian77@gmail.com
Guest
Posts: n/a
 
      08-26-2013
On Monday, August 26, 2013 5:03:13 PM UTC-5, Ike Naar wrote:
>
> You are using ::std (instead of plain std) in contexts where there
> is no way that another std namespace than the global one can apply.


namespace vv {
namespace std {

template <class T>
class vector
{
int a;
};

}
}

using namespace vv; // This could be in a header somewhere.

int main()
{
std::vector<int> nn;
}


clang++ 3.3 accepts that with no warnings. G++ 4.8.1 gives errors.
 
Reply With Quote
 
Ian Collins
Guest
Posts: n/a
 
      08-26-2013
(E-Mail Removed) wrote:
> On Monday, August 26, 2013 5:03:13 PM UTC-5, Ike Naar wrote:
>>
>> You are using ::std (instead of plain std) in contexts where there
>> is no way that another std namespace than the global one can apply.

>
> namespace vv {
> namespace std {
>
> template <class T>
> class vector
> {
> int a;
> };
>
> }
> }
>
> using namespace vv; // This could be in a header somewhere.


Could be, but it would be a really evil thing to do.

> int main()
> {
> std::vector<int> nn;
> }
>
>
> clang++ 3.3 accepts that with no warnings. G++ 4.8.1 gives errors.


Clang appears to be wrong, std:: is ambiguous in this context.

--
Ian Collins
 
Reply With Quote
 
Victor Bazarov
Guest
Posts: n/a
 
      08-27-2013
On 8/26/2013 6:51 PM, Ian Collins wrote:
> (E-Mail Removed) wrote:
>> On Monday, August 26, 2013 5:03:13 PM UTC-5, Ike Naar wrote:
>>>
>>> You are using ::std (instead of plain std) in contexts where there
>>> is no way that another std namespace than the global one can apply.

>>
>> namespace vv {
>> namespace std {
>>
>> template <class T>
>> class vector
>> {
>> int a;
>> };
>>
>> }
>> }
>>
>> using namespace vv; // This could be in a header somewhere.

>
> Could be, but it would be a really evil thing to do.
>
>> int main()
>> {
>> std::vector<int> nn;
>> }
>>
>>
>> clang++ 3.3 accepts that with no warnings. G++ 4.8.1 gives errors.

>
> Clang appears to be wrong, std:: is ambiguous in this context.


Why would it be ambiguous? There is no #include <vector> ...

V
--
I do not respond to top-posted replies, please don't ask
 
Reply With Quote
 
woodbrian77@gmail.com
Guest
Posts: n/a
 
      08-27-2013
On Monday, August 26, 2013 5:51:20 PM UTC-5, Ian Collins wrote:
> (E-Mail Removed) wrote:
>
> > using namespace vv; // This could be in a header somewhere.

>
> Could be, but it would be a really evil thing to do.


It would be evil if it was done with the hope of confusing
others.

 
Reply With Quote
 
woodbrian77@gmail.com
Guest
Posts: n/a
 
      08-27-2013
On Monday, August 26, 2013 8:11:19 PM UTC-5, Victor Bazarov wrote:
>
> > Clang appears to be wrong, std:: is ambiguous in this context.

>
> Why would it be ambiguous? There is no #include <vector> ...
>


Some of the emperors aren't wearing as much as they should be.
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Where can I get a "fastdebug" build of Java 7 for windows? Richard Maher Java 6 05-16-2013 12:21 AM
Feedback from feedback on MCP questions Matt Adamson Microsoft Certification 0 04-27-2009 11:13 AM
Request for feedback: adding vector types to STANDARD Peter Ashenden VHDL 5 12-17-2004 01:11 AM
SWsoft Acronis Disk Director Suite 9.0 Build 508, Acronis OS Selector 8.0 Build 917, Acronis Partition Expert 2003 Build 292, Acronis Power Utilities 2004 Build 502, F-SECURE.ANTI vIRUS.PROXY v1.10.17.WINALL, F-SECURE.ANTI vIRUS v5.50.10260 for CITRI vvcd Computer Support 0 09-25-2004 01:38 AM
Re: Accessing Request.InputStream / Request.BinaryRead *as the request is occuring*: How??? Brian Birtle ASP .Net 2 10-16-2003 02:11 PM



Advertisments