Bjarne Stroustrup and I are giving back-to-back talks on Tuesday night in Chicago, while we’re both in town for the standards meeting next week. Admission is free. Register by email here (and ignore the “it’s full / sold out” note on the page — see below.)
Note that my talk will be 80% new material followed by the last 5-10 min of my GoingNative 2013 keynote, so even if you’ve seen that talk most of the material will be new. Here are the coordinates:
A joint Chicago Chapter ACM and Chicago C/C++ Users Group meeting
Broad-spectrum C++/C++14 (Bjarne Stroustrup)
One C++ (Herb Sutter)
Tuesday, September 24, 2013
Doors open approximately 6:30 pm
Presentations run 7:00 pm – 9:30 pmRenaissance Chicago Downtown Hotel
1 West Wacker Drive, Chicago, IL 60601
Room A/B [or a nearby larger room, just follow the crowd when you arrive]
Note: The page says the event is at capacity and the primary registration link balks, but there is space because they keep expanding the room — it has already expanded from the original 100 seats to 200 and currently 300 seats, and they’re looking into moving to a still larger room as we speak. So do add yourself to the waiting list via this email link as it looks likely you will still be able to get in.
@everyone thnx :)))
I am very sorry for asking again despite it being off-topic, yet my rather limited understandig has left my quite confused. Was my observation of the codes behaviour wrong or is it simply no real problem because it has to be spelled out explicitly and would be hard to do without actually wanting to cause undefined behaviour?
@GregM: Right. I don’t see why this would be a ‘ticking time bomb’ any more than similar code in C#, where lambdas *always* capture by reference and if you capture a Disposable object you get the same use-after-Dispose issue — only silently without saying “ref” or similar in the code.
In this code, C++ actually forced him to write “&” everywhere to explicitly spell “capture by reference,” and he got exactly what he asked for.
VC++ 2010 /W4 warns you that you’re going to shoot yourself in the foot, and if you are good and use warnings as errors, it won’t even compile:
warning C4172: returning address of local variable or temporary
@Yuriy Grishin:
When using g++ you need to pass the -std=c++11 flag to compile c++11 code:
g++ test1.cpp -std=c++11
@Vipul S. Chawathe:
I presume the reason he calls it a ticking time bomb is the one stated in the files comment. The function he passes to f1(f) actually returns an int(although f1 expects it to return const int&), yet the compiler does not even emit a warning(at least mine doesnt, g++ 4.8.1, even with -Wall -pedantic -Wextra, I have not tried clang ;_;). Instead it silently coerces and treats it as if it returned a const reference. Now, if i understand correctly, the very moment the wrapper is called, the returned value is treated as a reference, which is quite undefined behaviour and could lead to serious trouble.
@Yuriy Thnx for reply.
I failed to recognize why the author (from the Wall family that created the PERL programming language) titled it as ticking time-bomb. C++ is my bread & butter & I just wished someone who has deeper grasp of the current standard to shed light. For me that’ll be an ahah moment as on some occasions I miss intricate details of the language specification.
@Paul: Thanks, I’ll switch to a better example of a Greek root.
I enjoyed your talk on Tues Sept 24, and especially the English to C++ parallels, and would like to suggest some small fixes:
a) the ending -ize is indeed from Greek and is verbal; but the “real” in reali(s|z)e is Latin; a better example might be bapti(s|z)e, since bapt- is Greek.
b) the examples of the Persian and Roman empires were good; but you might want to look at (i) the Chinese empire (was Mandarin not the sole official language?) and (ii) the Islamic empire (I think more like the Persian empire, with one overarching privileged language, and many local languages of use).
@Vipul S. Chawathe
the code does not compile
—————————————————————-
Microsoft Windows XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.
c:\prog\cpp\tests\cpp-core>g++ test1
g++: error: test1: No such file or directory
g++: fatal error: no input files
compilation terminated.
c:\prog\cpp\tests\cpp-core>g++ test1.cpp
test1.cpp:7:16: error: ‘function’ is not a member of ‘std’
const int& f1 (std::function func) {
^
test1.cpp:7:30: error: expected primary-expression before ‘const’
const int& f1 (std::function func) {
^
test1.cpp:7:51: error: expected ‘,’ or ‘;’ before ‘{‘ token
const int& f1 (std::function func) {
^
test1.cpp: In function ‘int main()’:
test1.cpp:14:20: error: expression cannot be used as a function
const int& p = f1(f);
^
c:\prog\cpp\tests\cpp-core>g++ -v
Using built-in specs.
COLLECT_GCC=g++
COLLECT_LTO_WRAPPER=c:/mingw/bin/../libexec/gcc/mingw32/4.8.1/lto-wrapper.exe
Target: mingw32
Configured with: ../gcc-4.8.1/configure –prefix=/mingw –host=mingw32 –build=m
ingw32 –without-pic –enable-shared –enable-static –with-gnu-ld –enable-lto
–enable-libssp –disable-multilib –enable-languages=c,c++,fortran,objc,obj-c++
,ada –disable-sjlj-exceptions –with-dwarf2 –disable-win32-registry –enable-l
ibstdcxx-debug –enable-version-specific-runtime-libs –with-gmp=/usr/src/pkg/gm
p-5.1.2-1-mingw32-src/bld –with-mpc=/usr/src/pkg/mpc-1.0.1-1-mingw32-src/bld —
with-mpfr= –with-system-zlib –with-gnu-as –enable-decimal-float=yes –enable-
libgomp –enable-threads –with-libiconv-prefix=/mingw32 –with-libintl-prefix=/
mingw
Thread model: win32
gcc version 4.8.1 (GCC)
c:\prog\cpp\tests\cpp-core>
Kindly shed light on C++11 ticking time-bomb illustration at https://gist.github.com/quietfanatic/6746964 Thank you. :)
Will the talk be available online ?
Yes, I saw those reports afterwards.
What is most baffling is the (unfortunately-as-usual) vacuous and even hateful comment threads. In the first couple of pages, I saw nothing but angry comments that people are making this up and should get a life.
As I mentioned in my talk on Tuesday night, my wife is a longtime satisfied iPhone user who is prone to motion sickness, and the gentler motion in iOS 6 and earlier never bothered her before. After installing iOS 7, she couldn’t even unlock her phone without a wave of nausea — the effect was immediate from the first unlock with iOS 7. And it isn’t just the parallax wallpaper (which wasn’t even enabled on her iPhone 4), it was the extra zoom motion everywhere but particularly on unlock, where the zoom animation was (a) slower and (b) irregular with different icons falling in at different speeds.
Calling people who report these problems “stupid” and claiming they’re making it up and should “grow a pair” is just foolish, yet that’s what every user comment I’ve read so far has said. Now, I realize comment threads are usually 90% foolish, but this is the first comment thread that was 100% foolish (at least as far as I read it). Fortunately the commenters here are much better and well over 90% reasonable and thoughtful — thanks! it’s much appreciated.
Herb, thanks for the great talk.
You mentioned the iOS 7 animations, and it seems some folks are affected by this: http://www.macrumors.com/2013/09/26/ios-7-users-complaining-about-motion-sickness-due-to-parallax-and-zooming-effects/
Will the talk be filmed and available later online Herb?
Kind regards,
Tom
Acccording to figures last week, that is the murder capital of gthe U.S.
Can we expect video recordings later? Thanks in advance.