Friday, January 9, 2015

Digest for comp.lang.c++@googlegroups.com - 14 updates in 4 topics

mathewji <itoneymathew@gmail.com>: Jan 09 12:52PM -0800

Programming: Principles and Practice Using C++ by Bjarne Stroustrup, chapter 6, page 219, exercise 7, "Write a grammar for bitwise logical expressions. A bitwise logical expression is much like an arithmetic expression except that the operators are ! (not), ~ (complement), & (and), | (or), and ^ (exclusive or). Each opeartor does its operation to each bit of its integer operands (see 25.5). ! and ~ are prefix unary operators. A ^ binds tighter than a | (just as a * binds tighter than +) so tha x|y^z means x|(y^z) rather than (x|y)^z. The & operator binds tighter than ^ so that x^y&z means x^(y&z)."
 
I need help with the whole question..
Victor Bazarov <v.bazarov@comcast.invalid>: Jan 09 04:10PM -0500

On 1/9/2015 3:52 PM, mathewji wrote:
> tighter than +) so tha x|y^z means x|(y^z) rather than (x|y)^z. The &
> operator binds tighter than ^ so that x^y&z means x^(y&z)."
 
> I need help with the whole question..
 
It's not a question, actually. It's an exercise. "Write a grammar"
means you need to use your hand/hands and some medium, like paper, to
construct and record expressions that would represent the rules stated
in the rest of the exercise description. If you've never written a
grammar, skip this exercise for now, it's probably not terribly important.
 
If it's part of your coursework, talk to your professor about "needing
help with the whole question." Most likely you missed something
basic/fundamental at the very beginning of the course if you feel
completely at sea with this.
 
V
--
I do not respond to top-posted replies, please don't ask
ram@zedat.fu-berlin.de (Stefan Ram): Jan 08 11:55PM

>The thing here was that both of them claim to support the full C++14
>language. One already being released, and the other one available "real
>soon now".
 
The last time I looked was about 9 months ago with - IIRC - GCC 4.8.
 
There were two things I wanted to show in the classroom.
 
The first was wished by the students, they wanted to learn
about threads. IIRC, the C++11 thread library was not yet
available with GCC 4.8.
 
The other thing was something that I wanted to show to the
students: regular expressions. But that was also not available.
 
Maybe GCC 4.8 supported the C++11 syntax, but not the libraries.
 
Or maybe I should have tried to use GCC 4.9? But GCC 4.8 was
easily available to me, while I was not sure how to install GCC 4.9
under Windows.
ram@zedat.fu-berlin.de (Stefan Ram): Jan 09 12:13PM

>"GCC 5 C++14 language feature-complete [2014-12-23]
 
Back to my OP: This might mean that GCC is feature-complete
/before/ the standard is actually published! When one takes
the standpoint that the standard does not exist as long as
it's not published as a standard by the ISO, one might
wonder what language they actually refer to. I mean:
People can get the /implementation/, but can't buy the
/specification/ of that language called »C++14«!
 
But then, they say »language feature-complete«,
not »library feature-complete«!
ram@zedat.fu-berlin.de (Stefan Ram): Jan 09 01:09PM

>A draft of it was approved two years ago as draft.
 
The actual approval of C++14 happened 2014-08-18,
then it was submitted to the ISO for publication.
ram@zedat.fu-berlin.de (Stefan Ram): Jan 09 09:01PM

>Write a grammar for bitwise logical expressions.
 
Choose the grammar notation. Do you want to use
EBNF or some other notation? If you don't know
what »EBNF« is, you want to learn EBNF.
 
Step one: learn EBNF.
 
Then look at this simplified grammer I wrote for
binary »+« and »-«:
 
<numeral> ::= '2' | '4' | '5'.
<product> ::= <numeral> | <product> '*' <numeral>.
<sum> ::= <product> | <sum> '+' <product>.
start symbol: <sum>.
 
How does it express the associativity of the two operators?
How does it express the precedence of »*« over »+«?
 
Does it express them correctly?
 
Can you extend my simplistic production for
»numeral« to be more realistic?
 
Can you add a unary minus with the usual precedence
and associativity?
 
After having followed all this advice, it now
should be more simple to do your exercise.
Chris Vine <chris@cvine--nospam--.freeserve.co.uk>: Jan 09 12:27AM

On 8 Jan 2015 23:55:21 GMT
 
> The first was wished by the students, they wanted to learn
> about threads. IIRC, the C++11 thread library was not yet
> available with GCC 4.8.
 
You recall incorrectly. gcc-4.8 supports C++11 threads, including the
C++11 memory model. Most of C++11 threads, but not the full memory
model, was available from gcc-4.5.

> The other thing was something that I wanted to show to the
> students: regular expressions. But that was also not available.
 
> Maybe GCC 4.8 supported the C++11 syntax, but not the libraries.
 
gcc-4.8 did not properly implement regular expressions: it was its
major fail. gcc-4.9 does support them.
 
> Or maybe I should have tried to use GCC 4.9? But GCC 4.8 was
> easily available to me, while I was not sure how to install GCC 4.9
> under Windows.
 
Are you surer about how to install clang-3.5 than gcc-4.9? What's your
point?
 
Chris
Chris Vine <chris@cvine--nospam--.freeserve.co.uk>: Jan 09 12:49AM

On Fri, 09 Jan 2015 00:03:55 +0100
 
> The thing here was that both of them claim to support the full C++14
> language. One already being released, and the other one available
> "real soon now".
 
gcc releases new branches at approximately annual intervals. The *.0
release is usually in March or April. As far as I understand it, that
is what is intended with gcc-4.10/gcc-5.0/whatever.
 
gcc does not claim to fully support C++14 in any of its current
releases. Nor have I seen the expression "real soon now" used in
respect of such support: the published schedule does not use that
expression. Care to provide a URL which does?
 
Chris
"Öö Tiib" <ootiib@hot.ee>: Jan 08 11:08PM -0800

On Friday, January 9, 2015 at 2:49:32 AM UTC+2, Chris Vine wrote:
> releases. Nor have I seen the expression "real soon now" used in
> respect of such support: the published schedule does not use that
> expression. Care to provide a URL which does?
 
Perhaps the news on front page can be interpreted like that?
https://gcc.gnu.org/index.html#news :
"GCC 5 C++14 language feature-complete [2014-12-23]
Support for all C++14 language features has been added to the
development sources for GCC, and will be available when GCC 5
is released next year. Contributed by Jason Merrill, Braden
Obrzut, Adam Butcher, Edward Smith-Rowland, and Jakub Jelinek."
Chris Vine <chris@cvine--nospam--.freeserve.co.uk>: Jan 09 09:53AM

On Thu, 8 Jan 2015 23:08:02 -0800 (PST)
> On Friday, January 9, 2015 at 2:49:32 AM UTC+2, Chris Vine wrote:
[snip]
> development sources for GCC, and will be available when GCC 5
> is released next year. Contributed by Jason Merrill, Braden
> Obrzut, Adam Butcher, Edward Smith-Rowland, and Jakub Jelinek."
 
Right. The problem with "real soon now" is that it is usually intended
perjoratively, implying vapourware or something running seriously
behind schedule. gcc-4.10/5.0 is neither of those. It is following the
normal gcc release cycle, apparently.
 
google did not choose clang over gcc for its future chrome releases
because it got its full C++14 feature set out 6 months earlier than
gcc, any more than it used gcc (gcc-4.6) beforehand because gcc got most
of its C++11 features out first. clang offers other advantages -
particularly the llvm toolset and better error messages. And, whilst
apple is the main contributor to clang, google also contributes
significantly, which means that it can tailor it more to its needs. The
clang C++ implementation is also a lot less buggy than it used to be.
 
Chris
David Brown <david.brown@hesbynett.no>: Jan 09 11:08AM +0100

On 09/01/15 10:53, Chris Vine wrote:
> apple is the main contributor to clang, google also contributes
> significantly, which means that it can tailor it more to its needs. The
> clang C++ implementation is also a lot less buggy than it used to be.
 
Just a comment for balance - google also contributes significantly to
gcc, and gcc's error messages have improved greatly in the past few
versions (arguably dues to "competition" with clang).
 
In most comparisons I have seen, gcc results in faster code than clang,
while clang compiles and links a lot faster. I suspect that google
continuously use both compilers, and make sure their code base is fully
compatible with both. At the moment, it looks like clang gives a
smaller and/or faster binary for chrome - but it could easily change in
the future.
Chris Vine <chris@cvine--nospam--.freeserve.co.uk>: Jan 09 12:00PM

On Fri, 09 Jan 2015 11:08:04 +0100
David Brown <david.brown@hesbynett.no> wrote:
[snip]
> is fully compatible with both. At the moment, it looks like clang
> gives a smaller and/or faster binary for chrome - but it could easily
> change in the future.
 
I think that's fair.
 
It is also worth noting that the switch to clang is only for making
chrome's pre-compiled binaries for linux. Chrome for android still uses
gcc, and for windows still uses visual studio. Looking at their own
blurb, it looks as if they decided they wanted to update their
compilers on the android and linux side to either gcc-4.8/4.9 (which
they have done for android) or clang-3.5, and they chose clang for
their linux binaries. One of the reasons for this appears to be
because with clang it is easier to integrate the binaries with the
system libraries, and in particular the older libstdc++ versions, which
may be used by linux distributions. In other words, they seem to be
using C++11/14 at the language level but not at the standard library
level except by bundling their own components, and that is easier to do
with clang. And chrome still apparently compiles with gcc-4.8/4.9, if
that is what individual distributions want to do.
 
Chris
"Öö Tiib" <ootiib@hot.ee>: Jan 09 05:02AM -0800

On Friday, 9 January 2015 14:13:54 UTC+2, Stefan Ram wrote:
> wonder what language they actually refer to. I mean:
> People can get the /implementation/, but can't buy the
> /specification/ of that language called »C++14«!
 
It is not yet approved as ready standard but it has been good enough
to implement the changes and improvements in it. Should the compiler
and library implementers wait until standard is fully ready?
No by modern agile development. Yes by waterfall.
 
Standard is specification for compiler and library implementers.
Like all specifications written by non-gods it contains some unclear
wording, ambiguities and other issues. A draft of it was approved
two years ago as draft. What has been done later is fixes.
 
> But then, they say »language feature-complete«,
> not »library feature-complete«!
 

The libstdc++ status:
https://gcc.gnu.org/onlinedocs/libstdc++/manual/status.html#status.iso.2014
 
The libc++ status:
http://libcxx.llvm.org/cxx1y_status.html
legalize+jeeves@mail.xmission.com (Richard): Jan 09 06:51AM -0600

[Please do not mail me a copy of your followup]
 
I've just finished a couple of days of experimenting with the refactorings
available in CLion from JetBrains. They did quite well on my test suite.
The results are summarized in this blog post:
<http://legalizeadulthood.wordpress.com/2015/01/08/refactoring-test-results-
for-clion-140-1221-2/>
 
The test suite has been updated with a CMake-based build and the results
for this build of CLion added:
<https://github.com/LegalizeAdulthood/refactor-test-suite>
--
"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>
 
 
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]
You received this digest because you're subscribed to updates for this group. You can change your settings on the group membership page.
To unsubscribe from this group and stop receiving emails from it send an email to comp.lang.c+++unsubscribe@googlegroups.com.

No comments: