« first day (213 days earlier)      last day (4735 days later) » 

3:02 PM
@rlc I don't remember seeing anything about that.
:(
 
sbi
@MartinhoFernandes ISTR C++11 supporting instantiating templates with function-local types. (That is, you can call std::foreach() with a function object defined within the function.)
 
@sbi How do you define a function object inside a function? Lambdas?
 
sbi
@MartinhoFernandes Like that:
void foo()
{
  struct bar {
    void operator()(int i) {}
  };
}
 
You can do that? What's wrong in that question then?
Templates?
 
sbi
@MartinhoFernandes This got nothing to do with the question.
Yes, you can do that. In c++03, however, you must not use that type as a template parameter. In C++11 (AFAIK) you can.
 
3:09 PM
@RonaldLandheerCieslak Still no inner templates I believe
 
So, as long as it's not a template, you can define local types? Nice.
 
Although I think someone is working on polymorphic lambdas on libstdc++ so one can dream...
 
sbi
@MartinhoFernandes In fact, I was surprised you couldn't do local templates.
 
It has to do with linkage doesn't it? No such thing as an internal linkage template. Not sure what implementations do with templates in unnamed namespaces.
 
sbi
4
A: Why inner "template" class not allowed inside function ?

James KanzeThe problem is probably linked to the historical way templates were implemented: early implementation techniques (and some still used today) require all symbols in a template to have external linkage. (Instantiation is done by generating the equivalent code in a separate file.) And names define...

:)
 
3:16 PM
Must have read that from JK or another clc++ regular on Usenet actually!
 
sbi
@LucDanton Oh, c'mon! You wrote that message here 21mins after James posted his answer! Do you think we're fools? :)
 
rlc
3:33 PM
so, if I see this right, an implementation detail for some implementations has the committee decide to just disallow an otherwise perfectly legal (and useful) idiom..
bah
 
@rlc Two words: export.
 
@RonaldLandheerCieslak long version: one of the aim of the Standard Committee is to codify existing practices
short version by Martinho
 
rlc
@MartinhoFernandes how is that two words?
@LucDanton I know - I don't have to like it though
excort, btw, was hardly useful, IMHO
 
@rlc I always use "two words" to mean "in a small number of words that I won't bother counting".
 
I like separating my definitions from my declarations :|
 
rlc
3:44 PM
@LucDanton so do I, but the export keyword wasn't worth the trouble, IMHO
 
You agree but at the same time you claimed it's hardly useful!
 
rlc
that said, I would probably have used it if it were usable and widely available
@LucDanton it's a question of a trade-off between the added complexity and the usefulness of the keyword
 
@Martinho granted.. but that gives the impression that you can't count past one. ;D
 
rlc
the people who implemented it argued for its removal from the standard
 
How does that make it less useful?
 
rlc
3:46 PM
@LucDanton "hardly useful" != "completely useless"
not useful enough..
 
And "less useful" != "completely useless" as well. I don't think this is going anywhere.
 
rlc
Only in a C++ chatroom would one get into a pedantic discussion about the semantics of the word "useful"
:-D
 
Oh, and I just noticed. You said excort above. Hmmm....
 
I didn't go there; I really only wanted to point out that you both said "excort, btw, was hardly useful, IMHO" and "that said, I would probably have used it if it were usable and widely available" without irony
Seems we don't use "hardly useful" the same way
 
rlc
3:59 PM
@MartinhoFernandes maybe I should have said extort :)
@LucDanton the reason I think it was hardly useful is because it wasn't widely available, the only team that implemented it argued against its use and for its removal from the standard, and the only promised advantage of the use of the keyword (separating definition from declaration) was a gain that, while it helps encapsulation and is possibly useful for maintenance, remains a minor one because it isn't needed to implement anything useful
removing a feature from the standard that has, for all intents and purposes, never been used, never been widely available and is not necessary to solve any real problems doesn't strike me as a problem
restricting the language because of an implementation detail while there are other implementations of the same language that could easily implement the feature in question (templates in functions) is in another league, IMHO
 
"I think it was hardly useful is because it wasn't widely available" That's perhaps what explains my confusion
I consider usefulness and availability strictly orthogonal
 
rlc
@LucDanton theoretical usefulness is orthogonal to availability, practical usefulness isn't, IMO
maybe I should prefix my use if "useful" with "practically"
 
4:18 PM
@RonaldLandheerCieslak I think you broke my brain with "practical usefulness"
 
@rlc When new features are proposed, if an implementor says that he would have trouble to implement it, there is a good chance that it will be dropped. As a matter of fact, there are things which are undefined just because defining it would prevent efficient implementation on hardware which have never had a C++ compiler and will probably never be.
 
I do think I understand you but huh it makes me weird
 
And export is one of the rare case where implementors were not listened to. That experience will make even less probable that it will happen again in the future.
 
rlc
@AProgrammer when export was introduced, there were no implementations that could handle it and being able to handle it was a far-fetched idea at the time. The same isn't true for in-function templates
 
> there are things which are undefined just because defining it would prevent efficient implementation on hardware
can you elaborate? As in it would be different to implement on different hardware?
 
rlc
4:27 PM
I agree that implementors need to be listened to generally - I just don't think implementation details should get in the way of progress
@TonyTheTiger the one-past-the-end delimiter of a range is a good counter-example, IMHO
I guess @AProgrammer has an example in mind though
@LucDanton you alright? call a doctor if there's steam coming out of your ears :-)
 
@RonaldLandheerCieslak Apparently reading examples from here doesn't help
 
@rlc hmmm interesting, not sure what would make it different in hardware, cause a memory access is still a memory access... maybe some hardware responds differently to memory accesses that have no data in them
 
hi
 
hi
what's new?
 
rlc
@TonyTheTiger some old CRAY architectures throw up when you load a pointer that doesn't point to a valid (dereferencable) address
 
4:31 PM
@rlc oh I see... hardware that can barf, interesting :P
 
rlc
on those architectures, an array like int a[5] would need to allocate a sixth int to be able to say int *end = a + 5
 
not much
what's the discussion about?
 
pedantic stuff
we're just talking about why certain things in c++ are undefined
 
I think you overstate the situation about export. export is nothing more than a formalization of the model which was used by CFront.
I tend to think that part of the problem with export was that to make it usefull, you had to use the iterated instantiation model. And switching the instantiation model for implementation which had another one is problematic.
 
because of what @AProgrammer said
13 mins ago, by AProgrammer
@rlc When new features are proposed, if an implementor says that he would have trouble to implement it, there is a good chance that it will be dropped. As a matter of fact, there are things which are undefined just because defining it would prevent efficient implementation on hardware which have never had a C++ compiler and will probably never be.
and they are talking about export
 
4:33 PM
well, I certainly think that languages should not go out of their way to handle obscure architectures
 
rlc
@AProgrammer I don't think CFront had a working export though, did it?
 
Is anyone else annoyed by your quality control asking for test cases, test code and expected behaviour from you, and then telling you a week later that everything works as expected?
 
rlc
and if so, how was EDG's implementation the first one?
 
@DeadMG but having features in the language that might put constraints on hardware should definitely not be the case, right?
@Raze no
 
yes, of course it should be
might?
 
4:35 PM
@TonyTheTiger For instance, there are provision for invalid representation in integer types. That would be useful on the Burrough machines -- and Unisys is still selling them -- but I doubt there was a C implementation on it, without speaking of a C++ one.
 
maybe I have a processor that only explicitly supports Brainfuck-style programming
 
rlc
@TonyTheTiger you mean having features in the language that would prevent some kind of useful innovation in hardware development?
 
there's a point at which you have to say, well, look, your processor should support this, and if it doesn't, we can't deal with that
 
@rlc yes that's what I mean, the language puts constraints on what hardware can implement in terms of FPU or whatever else
@DeadMG now that would be an interesting processor, a brainfucker!
 
rlc
@DeadMG AFAIK, anything can be translated to BF - it is Turing-complete, after all
 
4:37 PM
well, sure, it could be, but that doesn't make it practical for someone to implement a C++ compiler on it
 
@rlc web development in brainfuck is probably excruciatingly painful
 
rlc
@TonyTheTiger anything serious in BF must be excruciatingly painful
 
@rlc true, but I think in Whitespace it's gotta be even worse
 
rlc
@TonyTheTiger :-D
 
4:39 PM
Whitespace is an esoteric programming language developed by Edwin Brady and Chris Morris at the University of Durham (also developers of the Kaya programming language). It was released on 1 April 2003 (April Fool's Day). Its name is a reference to whitespace characters. Unlike most programming languages, which ignore or assign little meaning to most whitespace characters, the Whitespace interpreter ignores any non-whitespace characters. Only spaces, tabs and linefeeds have meaning. An interesting consequence of this property is that a Whitespace program can easily be contained within the ...
 
Golfscript is worse.
Befunge is pretty awful too.
 
name the worst programming languages
lol
 
@Raze Befunge is cool.
Malbolge is awful.
 
@rlc It hadn't the keyword export. The way it found the template definitions and generated the instantiation at link time was near in use model to export.
 
It took years to write an Hello world.
 
4:41 PM
@MartinhoFernandes horrendous
 
Think of a compiler in befunge. How many columns wide is it gonna be?
 
Ins't malbolge that language that mutates it's own instructions with every instruction?
 
Writing self-modifying code in Malbolge is pretty easy.
Writing non-self-modifying code in Malbolge is impossible.
 
the next virus should be written in Malbolge then
:)
write a kernel in Malbolge, then you can truly say that I make no guaruantees of this OS's behaviour
 
yeah, and the virus should ask the user to install the compiler first :))
 
4:44 PM
@Raze lulz
 
@Raze What if the compiler has a virus?
C, anyone?
 
@MartinhoFernandes compiler written in Malbolge, then everything is truly implementation defined, particularly, compiler implementation defined. :P
 
I'd be more afraid if it was written in C than if it had a virus
 
@MartinhoFernandes that would be interesting. the compiler has a virus, so it won't let you compile yours.
 
No, it has a virus that makes what you compile be malware.
 
4:47 PM
is a script that runs format C considered malware?
if you spread it in your program...
 
@MartinhoFernandes blank content.
 
@Raze self modifying PDF :)
 
:) letme download and check.
the link only contains uoto =. had to type in pdf. got it now.
 
Hi guys.
 
@TonyTheTiger Looks like a Turing Award Lecture.
that talks about quines.
Talking about quines, have you guys seen a 11th order quine?
 
Als
5:02 PM
Hey Guys
 
@Als hey
 
Als
Oops Hey All....(don't want to be called sexist)
:P
@Raze: Hey Raze, whats up?
 
@Als you thinkin bout Miss?
 
Als
@Raze: :) Not really..This room loves everything that has the word sexin it..so you never know when a pedantic rant would start about being SEXist.
;)
@Raze: Don't see you much in the SO main?
 
Hmm. Java, PHP, C# forums are where programmers discuss Java, PHP and C#. C++ forum is where C++ programmers socialise, and talk about sexism.
@Als once in a while, a Java question or two.
 
Als
5:08 PM
@Raze: I see...I've been prowling the C++ room for a lil while
 
there are enough C++ experts in SO, but not so many Java.
 
woot @ 500!
 
even though there are plenty of people who ask Java questions.
 
Als
I think SO is one of the best forums for C++, for the sheer amount of expertise that the long timers on the C++ forum bring in
@Xaade: is there a user@500 now?:P
 
My expertise of solving everything with Macros....
 
5:11 PM
@Xaade I also got 500 recently.
 
I can do almost anything a template can do, with an elaborate enough macro.
 
@Als yeah, there aren't many good alternatives. In the past I sometimes asked on comp.lang.c++.moderated, but SO is better really.
@Xaade are you looking for a fight :)
 
Truth is
So it be.
 
@Als yeah. And all regulars here, rock. Except maybe an anoying one.
 
@Xaade Including variadic templates?
 
5:13 PM
@Raze WAH..... hey now...
 
;)
 
Als
@StackedCrooked: Indeed, and the C++ Faq is really developing in to a knowledge centre, thanks to some members...a qucik name that comes to mind is @sbi, uncle faq :)
 
@Raze Hmm...we're all great, except the ones who aren't. Now there's a revelation for the ages! :-)
 
@LucDanton Hmm.... that actually may be possible. I can sum and loop with a macro.
 
@Xaade I used macro's too sometimes. And sometimes nice things can be done with macros that can't be done with templates, like Poco's exception hierarchy.
 
5:14 PM
Macro is code.... essentially... it's text replace.
So I can make a macro that makes templates...
 
Too bad Stroustrup doesn't like macros.
 
So I should be able to make a macro that can emulate variadic.
Besides, template may as well be macros that have in-compiler support for incorporating the type into class, instead of just text-replacing. Templates are upgraded macros.
The benefit of templates, is due to compiler support for understanding the types, is that you can get compiler errors and warnings, instead of having no clue what the pre-compiler ended up actually spitting out.
 
@Xaade Yeah. I wonder what is worse - debugging bad macros or debugging bad template code.
 
Just FWIW, there are entire languages based strictly on macro-replacement. m4 is pretty well known, but only barely qualifies as a real language. If you Google for sam76, you might get some rather interesting results though (it's an old, and probably now defunct macro-based language).
 
Saying those are "languages" isn't saying much however
 
5:19 PM
@Raze Do you actually get a debugging benefit from templates? I know you get a benefit of going through the compiler instead of pre-compiler and having all the understanding of the code the compiler brings.... but what debugging benefit would you get...
 
@Raze Error messages from templates can be a pain, but at least you get an error message. With a macro, you often just get bad results instead.
@LucDanton I'd agree in the case of m4 (and said as much). I'd have to disagree (at least a little) about sam76 though.
 
@Xaade that's what I'm wondering.
 
Lisp is famous for its powerful macro system, but even there it's recommended to avoid them unless you really need them.
 
Als
Macros = gross side effects = pain in the arse
 
@JerryCoffin Many a times, you only get an error so obfuscated, you spend hours debugging it anyway.
 
5:21 PM
@Als Not if you can prove a macro given an assumption about its proper use.
 
@JerryCoffin You don't agree that saying "sam76 is a language" isn't saying much?
 
Als
@Xaade: How can you ever check parameter validity in a macro?
 
the macro max(x,y) will do what it will do... proven to work as intended. So there's no need to question it. As long is you use it for its proper use.
 
@Als, yeah, overload doesn't really work with macros.
 
LLVM and Clang gives more useful debug info with templates though.
 
5:22 PM
@Als You can't. These things are up to the user to determine.
 
Als
One can pass anything to a macro and it happily accepts.
No parameter type checking!
 
But the fact remains that the user CAN determine these things. Which means you can prove the macro.
 
@Xaade , yeah, but then you need to write (x) instead of x to avoid nasty problems.
You're better off implementing it as a template then.
 
@StackedCrooked I second that. been bitten.
 
Boost.PP is cool.
(Sorry, too much text, I only read like 5 last ones. :P)
 
5:23 PM
@CatPlusPlus yep :)
 
Als
Lack of Parameter type checking is the biggest bane on Macro IMO
 
for example, the macro like this can't be proven. #define something(x,y) (x)##(y)
 
Also its biggest feature.
 
Als
you can never acheive that in Macros and easily acheived in functions
 
But it doesn't often happen that you encounter a situation where you can use BOOSTPP. I only used it once.
 
5:24 PM
Anyways, Stroustrup says.
 
what's the website where you can paste code?
 
Ideone.
 
Als
ideone or codepad
 
pastebin
 
I've replaced externally-generated header with Boost.PP solution, and it's cool (generated n-argument functions that emit events).
 
5:26 PM
@Raze yeah, but Stroustrup is biased. He created a system that he believes is better than macros, so it's natural that he'll recommend against them.
 
Pastebin doesn't compile, though.
 
@Raze Sometimes -- but in all honesty it's pretty rare (at least for me). Even when the text of the message means nothing, it at least points you to the problem, at which point it's often pretty obvious.
@LucDanton Okay, but itself that's not saying much. It was a fairly interesting language though.
 
@JerryCoffin LLVM is supposed to be a big improvement in that area.
 
It's a Clang feature, not LLVM one.
 
@Raze Clang, really. Yes, it does have excellent error messages. So, for that matter, does Comeau.
 
5:30 PM
@CatPlusPlus yes, Clang.
 
Macro summing variables
 
@JerryCoffin Sometimes text of the message points to a line in a header deep in boost or stl and you only know the name of your own file that fails compilation. Then you have to resort to binary search by commenting out chunks of code until it compiles :)
 
@Eugene Except sometimes you can't comment chunks of code.
 
@Xaade Then you have to squint really hard at it.
 
@Eugene While it'll often point to that as well, I've yet to see one that didn't (if you looked) eventually have something like "instantiated at your_file.cpp, line XXX"
 
5:36 PM
@Eugene Been there :)
 
@JerryCoffin MSVC often doesn't tell you line in your own code. One example is if you have a boost::bind somewhere and you changed signature of the function you are binding.
 
@Eugene MSVC 2005 often crashed on boost bind. (The compiler, not the entire IDE)
 
@Eugene I'll take your word for that -- it's not something I've seen (at least with a semi-recent compiler) even though I've used bind quite a bit.
 
@JerryCoffin but the actual problem is in line YYY where you declare it, not where you define it.
 
Great..... I still use 2005 at work.
 
5:38 PM
@StackedCrooked Good thing we skipped that one then :)
 
Does Intel have a free version of their compiler?
 
@Xaade 2005 isn't that bad, it's lean and fast. 2008 is better though. 2010 is too resource greedy for my taste.
 
@StackedCrooked Until Intellisense...
 
@Raze I think Linux version might be/was at some point, but not sure.
 
Intellisense on 2005 doesn't work too well :D I remember deleting the .ncb file frequently to have it rebuild.
 
5:40 PM
Intellisense.... Hey I'm done parsing your co... huh.... where's everyone.
 
Hey I'm done parsing your co... std::bad_alloc
 
@CatPlusPlus Theirs is one I wanted to try for a long time, but never could.
I used to hear that there were only two compiler that optimised well enough - GCC on Linux (not MinGW), and Intel on Windows.
 
I've been using QtCreator on Linux for over a year now. It's ok, but not really great imo.
 
It's not that different from MSVC, it produces only a bit better code AFAIK.
 
MSVC used to have an edge thanks to whole program optimization I would think..
 
5:42 PM
MinGW is utter crap and abomination and only use case for this is when you need free C99 compiler on Windows.
 
@Raze I don't see how MinGW changes the code generation of GCC; or is it that icc is that much better?
 
@CatPlusPlus really? I never really used it, but I thought it was well respected..
 
Especially since MS made compilers free.
 
Isn't it GCC + port of windows libs?
 
I shall write a compiler from assembly to C++!!!!!
 
5:43 PM
It's a poorly done port of GCC.
 
MinGW is about GNU, not just GCC
 
@StackedCrooked the problem I think is when it starts to use Windows APIs.
@Xaade Hah! Good luck.
 
Also it used to be years behind the mainline GCC.
 
@CatPlusPlus Nonsense
 
I don't really know how the things are now, but again, g++ speed alone makes it not worthwhile.
 
5:45 PM
@Xaade There used to be legendary coders in assembly who used some section as code at one point and as constants / values at other points.
 
@JerryCoffin Actually I tried to break bind on MSVC 2010 just now and there is pointer to my code, right in the middle of it all. So either I didn't see that before or they have better errors in 2010. Neat.
 
The package provided on the MinGW site used to be an old GCC yes; but anyone could build another one
 
@CatPlusPlus Visual Studio?
 
@LucDanton Oh please, for the longest time only official version was 3.x, and there were only some custom, very unstable builds of 4.x.
 
@CatPlusPlus But they're not ports
 
5:46 PM
I remember that for a puzzle contest I built my algorithm on both VS 2005 Pro and VS 2005 Express. Both builds had all optimzations enabled, and the Pro was 10x faster.
 
And again, on Windows, g++ speed is abysmal compared to MSVC.
 
@CatPlusPlus What changes in the code generation?
 
@LucDanton MinGW is (explicitly says it is) about porting Unix utilities to Windows. Ability to develop new, Windows-specific code is mostly an accidental by-product.
 
@CatPlusPlus Or do you mean compilation speed?
 
Generated code itself doesn't differ that much between GCC and MSVC, sans barely-working LTO in earlier versions of GCC.
 
5:47 PM
@LucDanton How about with lower optimisations?
 
@LucDanton Yeah.
 
rlc
FWIW, MinGW is a fork off Cygwin, and a port of GNU to Windows - (it's called Min imalist G NU for W indows). It comes with more than just a port of GCC and it's used with IDEs such as the one that ships with Qt
 
@LucDanton I suspect he means compilation speed. gcc uses fork, which is ugly to emulate on Windows.
 
@JerryCoffin Are you sure, I thought the defining feature of mingw was the ability to link with the WinAPI?
 
MinGW has a lot of wrappers around Windows APIs and interrupt calls, and THAT would be really slow.
 
5:48 PM
I never viewed MinGW as anything but a port of compiler, with a horrible MSYS attached to it as a means to run configure scripts.
 
rlc
the compilers that come with MinGW make native Windows programs using the Windows API
unlike Cygwin, which makes native Windows programs using the POSIX APIs
 
Heh, I remember Cygwin POSIX layer DLL being an endless source of frustration.
 
rlc
MSYS == cygwin's DLL, forked
 
@StackedCrooked It's able to, but directly on the mingw.org home page, it says: "MinGW, for porting of many Open Source applications to the MS-Windows platform ... "
 
You can use Cygwin + make + vc compiler also.
 
5:50 PM
"Oh, it looks like you have two versions of the DLL somewhere, in some process. So I'll just bugger out and not run at all."
 
@JerryCoffin alright.
 
rlc
@CatPlusPlus that's because it relies on a piece of shared memory between all Cygwin processes for its housekeeping
 
@rlc I know.
 
rlc
at least MSYS and Cygwin are no longer in conflict with each other
used to be you couldn't have both on the same machine without problems
 
@rlc That's one good thing, because I sometimes work with both (for fun).
 
5:51 PM
Thankfully I've never had problems with that.
Although MSYS is nigh unusable, and doing anything but running ./configure is a pain.
 
@CatPlusPlus Cygwin isn't porting gcc to windows. Instead, it's running gcc in its native POSIX, but porting Windows to POSIX. MinGW ports Windows to a more restricted subset of POSIX, but it's still the same general idea.
 
@rlc only if you have both in your PATH at the same time.
 
rlc
@Raze which was (and is) a pretty common phenomenon
 
Anyone here using Cygwin frequently btw? I would like to know if there's a command line based version of the package manage.r
 
rlc
@StackedCrooked daily
 
5:53 PM
@JerryCoffin Cygwin, yeah. But I treat MinGW as a GCC target, and don't really care about anything else around this project.
 
rlc
the package manager works on the command-line
I've dropped mine in /bin - works like a charm
 
@rlc I keep cygwin in my path. Mingw only when I compile stuff.
 
@rlc What is its name?
 
rlc
@StackedCrooked cygwin.com/setup.exe
 
I make wrapper scripts for Cygwin utils I need to have on PATH, and don't expose any DLLs.
 
5:55 PM
@rlc It also functions as a console app?
 
rlc
yes
 
Btw, I seem to have noticed that on Windows system paths are searched before user paths. Does this make any sense?
 
rlc
it shows the window, but you can run it unattended
 
@rlc Gonna try it out.
 
rlc
try the --help option
 
5:56 PM
@rlc ok
 
rlc
@StackedCrooked IMO, no
 
@StackedCrooked Sort of -- I'm pretty sure it's a security thing. Makes it (marginally) harder for somebody to set things up so you unwittingly run their code in place of the system's.
 
@JerryCoffin I figured security was the reason...
 
@StackedCrooked err, no. Its just based on the order of things in you %PATH%
echo %PATH%
 
@StackedCrooked Actually, looking more carefully, their bolding mislead me and I took that quote a bit out of context. The whole sentence is talking more about using MSys in conjunction with minGW to port utilities to Windows.
 
5:59 PM
system32 and WoW are searched implicitly AFAIR.
 
What does AFAIR mean?
 
@CatPlusPlus no
 
As far as I row? :D
 
As far as I can remember.
 
try this in a cmd console:
set path=
 
6:00 PM
Ah.
 
then cmd
 
4
A: Overloading on R-value references and code duplication

sellibitzeRecycling temporaries is an interesting idea and you're not the only one who wrote functions that return rvalue references for this reason. In an older C++0x draft operator+(string&&,string const&) did the same. But this got changed for good reasons. I see three issues with this kind ...

I like this answer!
 
@Raze Yes, but the path you get at the command line contains both what's set up for path by the system and by the user -- but the system part comes first (by default, though of course you can change it after the fact).
 
@Raze Well, could be. I'm probably remembering DLL search rules.
Too much stuff in memory, OOM killer is running and killin'.
 
@CatPlusPlus yes, about dll, it will search either system32 or SYSWOW64 depending on wether your app is 64 or 32 bit (system32 for 64 bit and syswow64 for 32 bit), C:\WINDOWS and current dir IIRR
But the best fun you can have with Windows path and command line is when you mix CMD scripts with bash scripts running on Cygwin!
Ok, gotta get back to my Swat4.
 
6:39 PM
Temporaries should remain temporaries. Too much risk in reusing them.
 
T const& t = T();
You're too late...
same with T& func();
if whoever designed the function isn't clear about ownership
(but I'm addressing something you removed, sorry)
 
Well, I wasn't sure what the result of putting a temporary into a reference would be.
It depends on what the operation actually does. Would it create a copy, or actually leave the temporary in the reference.
 
T&& t = T(); is safe
 
If the temporary is out of scope, then the reference isn't valid.
 
Yes, like it works today
 
6:44 PM
T&&?
 
sbi
@LucDanton No. With T& ("today") it's the other way around: if the ref is out of scope, only then goes the temporary.
 
@Xaade Rvalue reference.
 
rvalue reference (I thought you were adressing this)
 
@Xaade Binding a const lvalue-reference (or any rvalue-reference) to a prvalue will extend the lifetime of the temporary. Binding to an xvalue doesn't, because for starters, the compiler cannot even know whether the xvalue even denotes a temporary object or not.
 
@sbi Somehow I thought this was about the pathological cases like { T& t = *new T(); delete &t; /* t is toxic now */ }
 
6:47 PM
No sane C++ programmer would ever write T& t = *new T();.
 
What do you think pathological mean?
 
No, a sane one would put a parent's pointer into a reference of a member of the child (parent/child as seperate objects, child contained, not inheritance).
 
Also this wasn't the point; it was to fit the line
I could have written { T& t = func(); /* something happens*/ /* t is toxic now */ }
But it's not exactly clear what's happening is it
 
So, if you have a = b..... what would A&& refer to?
 
rvalue-reference to A type (assuming no reference collapsing)
what does a = b have to do with it?
 
6:51 PM
rvalue is what's on the righthand side of the operation, or am I confusing terms.
 
Ah
This is because rvalue references are not rvalues; they're lvalues
 
...
How can the left side refer to the right side of an operation?
 
If you have T&& t = /* whatever */ you can do everything you want with t that you could do with it if it were T&
the difference is what the reference binds to
a non-const lvalue reference only binds to lvalues
an rvalue reference only binds to rvalues
Forget an instant about rvalues and lvalues
There a A references and B references
A refs bind to some kind of expresions, and B to others (exclusively)
But all those references are lvalues
 
Wait....
So if I did this
A&& operator = (A& something) { return something; }
I'd end up with a reference to the object on the right side of the equal sign, regardless of what the operation did.

So if my code did this:
if (bob = sue) ...

I'd actually check against the object sue instead of the object bob
 
I don't understand the (...) { ... } notation
 
6:59 PM
... means some unstated code
 
gah
 
if (bob = sue) { returnvalue = 0; }
 
Sorry I thought this was a variable named operator
 

« first day (213 days earlier)      last day (4735 days later) »