« first day (701 days earlier)      last day (4472 days later) » 

03:00
I use SlickEdit, seems like it offers a lot of what VA X does
@Rapptz Alt+Enter pops up the list of possible fixes on the position of the cursor.
You people and your enhancements. Vanilla 4 lyfe.
"Stack Overflow will be read-only briefly around 5PM UTC while we move some servers to a different rack. We really hope this works. "
@Chimera that was 12 hours ago
Maybe I'll watch the Sci-Fi series Dune again.
03:01
@Chimera i use slick edit at work
@pyCthon it's nice huh?
@pyCthon Still showing it for me.
yeah its showing for every one
wonder if they are having difficulties
@Chimera server stuff never goes as planned
@pyCthon very true
03:24
:( my post is no longer on the front page of codereview
hello
do you recommend C, C++ or C#?
for what?
Any programming experience? I can describe them.
I miss Python's char*number = fill string
like '4'*4 = "4444"
yep... that's C for you...
03:34
what?
@Chimera In Python when you do a character, say 'e' and you multiply it by a number you get a string "eeee".
doesn't look like C
@Rapptz Yeah, I was asking about @Griallia 's comment
I was responding to Rapptz
but I don't see any C code here
Anyway. I just got done with reading up on design patterns. Any recommendations on what to do from here?
03:36
Write code
So I assume that's about it for planning better code then?
Just read, learn, write and ask questions.
I always do programming challenges and used to do project euler to get better.
I don't really recommend Project Euler though because it's heavily math based and not for everyone.
user406009
You guys should read this:smbc-comics.com/?id=2736
user406009
Deep as heck.
03:44
Yes.
Xeo
Xeo
5
A: Why don't std::algorithms work directly on containers as well?

Dietmar KühlThere are two main reasons I can see: Adding overloads for containers would more than double the number of functions: For each algorithm taking just one range, the overloads would double. However, for something like std::copy() you have two ranges, each one of them independently wants to be spe...

Awesome answer with a great proposal, IMO
I use algorithms :(
04:13
Algorithms are great
I learned about them in Scott Meyers': Effective STL
 
2 hours later…
06:17
It's really quiet in here.
 
2 hours later…
07:56
too quiet. people must be coding... or sleeping.
08:10
When i open a program from the command line, i can enter arguments between "". but when normally opening the program. I cant. Why?
yay 2k
9 hours ago, by sehe
Rack Exchange
^ When I saw that on the starboard, without any context, the wrong definition of "rack" came to mind.
@bamboon Woah... exactly 2k. Congrats!
Ah yes
The great breast exchange.
BigInteger is starting to cockblock me really bad.
@Rapptz um... That's an strange choice of words.
Possibly.
08:20
@Mysticial thanks
When representing the double quotation mark between 2 single ones. Which one is correct?

'"' or '\"'
latter
It's an escape sequence.
or you could do char c = 34;
@Rapptz I know. I was just checking if the same representation of " in strings was needed in single quotes
@MohamedAhmedNabil I just compiled, all 3 work.
08:35
@Rapptz Thats why I asked. It seemed a bit odd
What a pointless question. :|
@Rapptz I had problems with my compiler before :/
@Rapptz When a person enters a command line argument between "" , They are discarded before the argument is stored in argv?
I don't use CLI, sorry.
At least not.. you know in C++ code.
@Rapptz Assuming ASCII or something ASCII-compatible.
@Rapptz ok. Cause it seems on the command line I can enter "C:\....\file" but when i normally open the program i have to enter it like this C:\..\file
08:41
Because you're supposed to do "C:\\...\\file"
Double backslash, not single.
@Rapptz nope. Thats just in the code. not when the user enters, or is it??? hmmm
That doesn't make any sense.
@Rapptz The double backslash thing is only a conversion in the code itself. Not when the user enters input
@MohamedAhmedNabil Open up your CLI and try inputting without double backslash.
@Rapptz Worked
08:45
Doesn't work for me on Git Bash and cmd. Well when inputting string literals obviously.
Never mind, it works with cmd but not on git.
@Rapptz worked in cmd. In cmd the double quotes are only in case there are spaces in the filename.
09:11
Morning gents
09:43
Marning
mawning
is writing do std::vector:data UB?
huh?
@DeadMG wassup?
not much
@bamboon That question actually makes little sense.
09:55
@bamboon No.
@Insilico oops sry, I meant to instead of do
@LucDanton ok, thanks
@bamboon It still doesn't make a lot of sense. What do you mean by writing to std::vector?
@bamboon Writing to the function pointer? :P
If by writing you mean vec.push_back(...);, of course it's not UB
But if by writing you mean vec[100] = ...; where vec only holds 50, then it is UB.
@Insilico arg, std::vector::data
09:57
@Insilico He means something like memcpy(vec.data(), ...)
yeah, exactly
@bamboon Then why didn't you ask "Is memcpy(vec.data(), ...) UB?"
that is the whole purpose of providing data().
@Insilico don't know, thought the other one was more general
@bamboon It is. The memcpy one could be UB for stuff like if vec is of non-POD.
whereas your original formulation merely asks for writes
09:59
@bamboon Well, there's lots of different ways of stuffing data into a vector, all with different semantics.
@DeadMG Or if vec is empty. (I feel I should mention this, you never know..)
@DeadMG yeah, but isn't writing to std::string::data UB?
@StackedCrooked I always know :P
@bamboon No.
that's c_str() and that's const-qualified anyway
@bamboon You can't modify that, you get charT const*.
ah yeah right, mixed that
10:02
@LucDanton Oops, forgot that std::string::data returns const CharT*.
You could also write to &str[0].
@Insilico It does?
then what's the point of having it instead of c_str()?
just to be uniform with vector?
Ya.
Also std::array.
At least since C++11.
10:05
It's also problematic to allow mutation due to the null terminator.
right
but that's not very uniform, because vector has a non-const overload
@DeadMG Yeah, but it's probably better that way to guarantee the null terminator invariant.
They're uniform in that (c.data(), c.size()) is a valid readable range for all of them.
@Insilico Stupid null terminator. Why would the Standard even require that? You could create an implementation that doesn't have one until c_str is called.
std::string doesn't have a null terminator unless as seen through c_str or data.
10:08
56
Q: Is string::c_str() no longer null terminated in C++11?

MankarseIn C++11 basic_string::c_str is defined to be exactly the same as basic_string::data, which is in turn defined to be exactly the same as *(begin() + n) and *(&*begin() + n) (when 0 <= n < size()). I cannot find anything that requires the string to always have a null character at its en...

Looks like C++11 effectively requires null termination.
@Insilico s.begin() + s.size() isn't dereferenceable.
@LucDanton Then what would be the problem if some muppet mutated it away? You could just put it back the next time c_str() is called.
Although actually operator[] also does present the null terminator.
@LucDanton Presumably, it generates s.end()?
@DeadMG Thanks.
10:11
anyway
I need brekkist
@DeadMG I suppose it's a holdover from when std::string was hoped to be an abstraction different from a container. (See operator[].) Doesn't really make as much sense nowadays indeed.
@DeadMG how did your google interview go?
10:32
@DeadMG cockney? or just nonsense?
Moaning all
@Rapptz What's the clue of that sequence? I don't get it. Probably because I don't know the game format (why is there handwriting?)
11 hours ago, by sehe
@saadtaame Most often, two units of roughly the same size, mounted in front
'normally'? The answer is real simple: command line processing is done by the command line shell. (cmd.exe, bash, sh, powershell, whatever). It translates them into an arrary of strings. Of course the quotes have been dropped by then.
If you use exec[vpe]* family or CreateProcess on windows, obviously you need to process the arguments yourself. Quotes have no bussiness in the final argument values
@Xploit or dead
@Rapptz Isn't std::string s("Hello"); potentially more efficient? ;)
@Chimera That was one interested soul :) (4 prime factors in that one, the force was weak)
@R.MartinhoFernandes Together with F12 or Alt-F12 to navigate the code annotations/errors /cc @Rapptz
10:49
@TonyTheLion Why the temporary? Just create a larger array, copy the elements in, reseat the pointer, done. Or just use std::vector<int> and don't worry about this stuff.
Mmmh, is it possible at all to write a zipped range that can deal with lazy ranges? Seems like a bad time to think.
@LucDanton Always that way for me :)
@LucDanton Anyways, I don't you think can. I have had limited success with lazy ranges. I sort of reached the pessimistic conclusion that it is invalid to evaluate them after the end of the full-expression in which they were created. (I based this on a half-baked understanding of internal tempvalue references)
What? How do references come into the picture?
It's what I use lazy ranges for - accidentally maybe
The idiom would be range | indirected | sorted (Boost Range style adapters)
Mmmm. I just had a little deja-vu. I think we had a parallell discussion like this, involving Proto expression templates (using them with auto&). The upshot there was that it could have been done differently by copying members instead of referencing them.
11:06
Ya.
Maybe the same goes here. See: not a good time to think :)
Ranges don't have the luxury of being made 'temporary-safe only', like an EDSL can. Because of the way range-for is specified, which starts by auto&& range_expr = range-expr;.
I could introduce a special zip_end_iterator, such that comparing a regular zip_iterator to a zip_end_iterator returns true iff any iterator is equal to its counterpart.
Mmmh, that won't ever typecheck. I think the 'end' status must be part of the state of the zip_iterator. What a shame.
@sehe What is a tempvalue reference?
That ought to work. Reminds me of an awkward contraption I once created in an answer by KerrekSB: gist.github.com/1394671#file_merge_maps_iterator.hpp
@FredOverflow reference bound to unnamed temporary - i.e. lifetime extended. That's what I meant, anyway
Lifetime extension only happens very rarely. Are you sure that's what you meant?
11:16
That merge_maps_ thingie had (big) naming issues. It was not an iterator, a view came closer. Well, it somehow did what had been asked but it didn't really satisfy my own 'generality' requirements
References don't extend lifetime, variables do!
@LucDanton Didn't say the reference got extended. Too many words in one sentence giving way too much opportunity for misinterpretation, it seems. Insert the implied [variable] before the dash, if you wish
@sehe I didn't imply you said that.
I would have needed to say "references aren't extended".
Ah. Too subtle for a Sunday.
A member is not a variable btw.
11:19
@LucDanton All data members are variables. Unless you can show me a data member without a name.
Clash of titans
@FredOverflow That conflicts with the Standard definition. I'm note sure how names enter into that, too.
Things that have names are entities. This includes both variables and class members.
@FredOverflow unused parts of bitfields don't count, eh :)
@LucDanton A variable is a named object in C++.
Although that is an informal definition.
@FredOverflow Obvious counterexample: int& ref = whatever;
11:23
is ref not a reference variable?
Yeah. Hence his definition is bogus.
> A variable is introduced by the declaration of a reference other than a non-static data member or of an object. The variable’s name denotes the reference or object.
Interesting, the italic part is new to me.
So int& ref = whatever; is a variable, unless it is a member.
Do note that a class member is still not a variable.
Assume struct foo { int bar; }; foo f;
Members are variables, unless they are references, according to the above quote.
Then foo::bar is the class member, and f.bar is the object.
11:25
class Foo {
    int x;   // variable
    int& y;   // not a variable
};
int &z = whatever;   // variable
An object implies a region of storage. foo::bar is not a region of storage.
Sure it is. The standardese is "subobject".
wtf
Of what object is foo:bar a subobject, and what's its address?
Ah, I think I get it now.
Right, foo::bar is a designator or something :)
I'm still looking why that 'other than a non-static data member' part is needed though.
11:31
Somehow it seems important that member references are not variables. As to why that is necessary, I have no idea.
You could make a stack overflow question with a standard quote and become rep-rich over night!
I was worried about unnamed classes with reference members but unions can't have those so it's all good.
@FredOverflow Oh wait, then that makes total sense. Members don't declare variable, references or not.
Non-static of course etc.
> the type of a non-static data member is an ordinary object type.
Type.
Also context, because a non-static data member can be a reference?
It seems the standard is not 100% consistent...
I doubt it.
Where do you see that?
11:43
References are not objects. There are data members which are references. Data members have object types. See the conflict?
No. Give context please. In the context of unions your quote is painfully consistent.
class Foo { int& x; }
x is not an object, yet it has object type.
I'm sorry but that's not what 'context' means.
If I Ctrl-F your quote all I find is a non-normative note.
Oh, you want the paragraphs?
There isn't any particular spot that defines the meaning of 'data member', but it can be construed to be a counterpart of 'member function'. I can't find anything that suggests that they should not have reference type.
11:56
18 mins ago, by FredOverflow
> the type of a non-static data member is an ordinary object type.
9.2 §11
So now you give the reference. It's paragraph 12 over here, and as I've said, it's non-normative.
38 mins ago, by sehe
Clash of titans
How is a clause in the standard non-normative? What exactly does that mean?
Oh, you mean because it's just a draft?
I think this stuff is explained in another ISO document, much like the IETF has an RFC that documents the meanings of 'SHALL' and the like. At least I can't find anything explicit in the Standard itself.
@FredOverflow No.
In any case 'non-normative note' means those things starting with '[Note :'. They are never normative.
@LucDanton Are you studying?
12:28
hai
Not much, just been to teh gym
What are you up to?
just been shopping
now chillin
nice, what did you buy?
12:31
nm
just had to get some cash
but the closest cash machine is a while away
then went for a coffee
cause bored
So where in the UK do you live?
the Googles doesn't really need to know taht
so I'm not gonna post it here
not that I mind you knowing
but this chat is indexed by Google
12:33
see my point?
Google knew just fine
At least they called you a "roaring" (har har) success
@sehe Just out of curiosity, what are you working with?
12:36
What do you mean?
Where do you work and what do they do =)
@ManofOneWay Dayjob: C#, PL/SQL. Otherwise: gcc 4.7. Life: kids and keyboards
@ManofOneWay General consultancy firm, big on microsoft (which I'm not particularly fond of). I add my value by being in all the niches I can find. Which is heaps
niches :) Nice
12:38
I see =)
After Monday and Tuesday, even the calender says W T F.
My C++ book from Bjarne says that I should prefer vector over string unless I need specific string operation such as concat or reading whitespace separated words. Hmm interesting
@sehe that's old.
Not for me. I'm not smart like that
@TonyTheLion Probably wise. std::string is a rather large cockup, really.
12:44
cool :) I'll remember that piece of advice
@TonyTheLion Well, isn't that obvious? Vector is much more generically adapted to the rest of the standard library. Strings merely carry the 'suggestion' of being better for text
yes, well because they carry that suggestion, any newbie (as I did) might think that it's better to use std::string for anything that has text in it.
anyone who really needs text handling has to find a Unicode lib anyway
Strange advice... std::cout << x does not even work for vectors.
@FredOverflow You could overload op<<, no?
12:47
And you can't initialize std::vector<char> with a string literal.
@DeadMG How's the book going?
@ManofOneWay Threw out another 5,000 words.
Nice, mind if I read it sometime?
you can find the previous version at wide-language.com/cpptuts/index.html
@DeadMG Using Pascal on a C++ book
12:52
@sehe hm?
@DeadMG c2.com/cgi/wiki?TimeToMakeItShort: Thus BlaisePascal's comment (I paraphrase): "I apologize that this letter is so long - I lacked the time to make it short."
I think some others have said similar things: writing with the eraser etc
oh, I don't mean "threw out", I mean, I wrote them
Urfff. That was obvious
13:10
bitching streams are counter intuitively named
input and output is viewed from environment, not from program.
damn confusing
istream writes to environment
and ostream reads from environment
meh
std::istream is read from. E.g. std::cin.
@TonyTheLion wtf is environment in this context? IMHO that is a far more confusing term
13:26
@sehe everything that's not your program
so disk, file, whatever
@TonyTheLion then this seems entirely backwards
how do you view it?
istream is for the program to take input.
seems to work for me
@TonyTheLion For me too. I have only ever had an inkling of 'ambivalence' when working with std::istringstream / std::ostringstream for conversion purposes. This can be 'slightly' confuzzling. But not enough to actually complain about :)
sbi
sbi
13:30
Wow, this room is empty. Not even 20 users here, half of which probably are asleep. An almost intimate setting.
So, dim the lights, take the stage. It is campfire time
Anyone bring a guitar?
mmm. audit messages can't be moved. This may not be a smart technique :)
I haven't used my guitar in years, it's probably tuned itself to C# or F# by now.
@FredOverflow I reckon you'd normally expect to find one tuned in E? Just to resolve the ambiguity?
13:38
Yes, E is the normal tuning.
Then how would you expect it to creep up to F#? Or did you mean, a minor seventh down?
I don't know, wizards? :)
(hint: you could always assert you forgot about the capo)
When I search for "Zipper Haskell" in YouTube, why do I get Christian boy groups and horses as results?
13:40
also jewelry
@FredOverflow because, who else zips horses
Should be interesting. Nice intro music.
sbi
sbi
13:54
@sehe Hint: Those were both programming languages.
3
Q: AltGr keys don't work with Ubuntu in VirtualBox

Alf P. SteinbachI just installed VirtualBox (from Oracle) in Windows 7, and created a virtual machine with latest Ubuntu. Here in Firefox I can use the left Ctrl key, while the right one doesn't have any effect. However, I can't use the AltGr key (also known as Right Alt) to produce e.g. curly braces like {} (I...

^ How come I get "popular question" badge for that? Only 3 upvotes?
@sehe The normal state of guitar tuning is that creeps up as the tuning is corrected (by ear). Then at some point the upper octave E string breaks. It's a good idea to keep hands away when that happens.
@Cheersandhth.-Alf doesn't popular question go by number of views
Hmmm I'm trying to overload operator>> for std::vector but I'm a bit confused how I write more than one char at at time? I need some kind of a loop, but over what?
std::istream& operator>>(std::istream& is, std::vector<char>& v)
{
  // std::vector<char>::iterator it = v.end();

	is >> v[v.size()-1];

   return is;
}
this only writes one char to end of vector
what if I type more chars in console
14:10
u mean read
Xeo
Xeo
auto it = std::back_inserter(v); while(is >> *it++);?
i would use getline from <string>
why are you using vector instead of string?
Xeo
Xeo
Or maybe even use a streambuf_iterator
@Xeo Won't work.
Xeo
Xeo
@LucDanton Right
std::istreambuf_iterator<char> in(is);
auto out = std::back_inserter(v);
std::copy(in, std::istreambuf_iterator<char>(), out);
of course, you could also do that in one line
14:13
@LucDanton you're right, compiler barks
Xeo
Xeo
or maybe even v.insert(std::istreambuf_iterator<char>(is), std::istreambuf_iterator<char>());
^ Repost, just 'cause it's nice song ("Sultans of Satan" by Kvelertak)
.
@Xeo compiler barks. Cannot convert from istreambuf_iterator to std::vector::const_iterator
Xeo
Xeo
wait, insert should take any arbitary iterator
Ah
I forgot to add the position
v.insert(v.end(), std::istreambuf_iterator<char>(is), std::istreambuf_iterator<char>());
maybe .assign is a better idea
if you want to overwrite.. hmm
Xeo
Xeo
14:20
of course, you can always go with char c; while(is >> c) v.push_back(c);
@Xeo Much like int i; std::cin >> i; gets rid of the old value forever (unless it doesn't, but you know).
@Xeo funny, this one gets stuck on the copy line. It never responds to an enter to finish the insert. When doing it from std::cin >> v;
Well if you wanted a line you should have said so.
std::istream_iterator is more applicable then.
@LucDanton what's the difference between a line and a series of char, I mean they both end with Enter, no?
No. Consider a file, it may contain more than one line. It is possible to read all the characters at once, forming one big sequence.
14:24
ha!
If you try your operator>> as it is with a filestream rather than std::cin you may get interesting results. Or try Ctrl-D or whatever is applicable to your system.
Talk about reliving nightmares....
0
A: Efficient ways to save and load data from C++ simulation

Jonathan SengIn this case, there is no "best." What is best for you is highly dependent upon your situation. But, lets have an example to get you thinking about your details and how deep this rabbit hole can go. If you absolutely positively must have the fastest save possible without question (and you're w...

That question, more specifically my answer, makes me want to go back to bed for a year.
headphones were resting on a key
@DeadMG What's the matter buddy, feeling all right?
Oh.
14:44
Oh, it's not just operator== that is tricky for zip iterators, but distance as well.
Or is it? Wtf.
zip iterator?
sounds familiar but I struggle to recall exactly
Xeo
Xeo
@DeadMG tuple of iterators to different containers
wtf I had my monitor die on me :(
did you give it a proper burial
Well I'll have to diagnose later to see if resuscitation is possible.
Xeo
Xeo
14:56
@LucDanton Well, normal semantics for a zip iterator distance would be to return an array of distances, wouldn't it?
But that wouldn't work well with the standard established std::distance :s
@Xeo That doesn't tell you how much you can increment it.
Xeo
Xeo
maybe return the mnimum distance before one iterator "runs out"?
Well no, minimum.
well, logically, the distance which you can increment a zip iterator is the minimum distance of all it's iterators.
Xeo
Xeo
err, right
14:57
I don't understand why that's not the default behaviour of zip_iterator either.
return tuples::foldr(
    ops::min {}
    , std::numeric_limits<std::ptrdiff_t>::max()
    , tuples::zip_with(
        ops::minus {}
        , lhs.get_iterator_tuple()
        , rhs.get_iterator_tuple() ) );
Isn't that neat?
Xeo
Xeo
oh wow

« first day (701 days earlier)      last day (4472 days later) »