« first day (756 days earlier)      last day (4185 days later) » 

12:03 AM
ir0n
 
user1357851
I have 20 rep and doesn't look it is hitting 100 anytime soon :D
 
does? doesn't?
 
user1357851
@sehe Thanks for correcting :D
 
tinyurl.com/d57bh9f - in case anyone cares about not that great proposal proposals and didn't see this one yet.
Hmm, I think I should stop spamming this link everywhere.
 
@Griwes Looks safe to ignore
 
12:13 AM
Eh.
 
@sehe I'd agree. Despite code that uses it looking like code that uses an existing operator, it requires inventing an entirely new and different operator. Worse, the parser has to know whether a target class implements the overload (i.e., implementing the operator changes how the code needs to be parsed). I can't imagine anybody who's ever even gotten close to a parser favoring this proposal.
 
@Telkitty posting birds again?
 
@Telkitty Pretty hard to get much rep with only one answer posted.
 
user1357851
@sehe newb guide goes not load 4 me ... no idea how to attach image :x ... would it be <img> tag, the [img] tag or woot?
 
user1357851
@JerryCoffin true
 
12:18 AM
@Telkitty Just the link:
 
@sehe I think you quoted the wrong person.
 
o_O
Bach and a Bird.
A very fat, apparently disgruntled bird.
 
@EtiennedeMartel yeah
 
Look at the history for posts to see what others used: chat.stackoverflow.com/messages/6172008/history
 
user1357851
lovely isn't it, I know XD
 
12:20 AM
@Rapptz fixed :)
@Mysticial wasn't there a public subset?
 
@sehe Not yet, but it will be the digit viewer.
 
Won't that be huge?
 
Come on, you can't do that..
That's.. rep-tist.
 
> The problem is your key is "ResoX " not "ResoX"
That's the entire answer :)
 
user1357851
12:23 AM
 
I'm so confused
 
@Telkitty hotlinking is disabled by checking referrer or cookies. You can use the "Upload" button (on empty text area). This will (I presume) upload via your own browser so there is no problem
Also... ASCII art in a GIF?
  |\      _,,,---,,_
  /,`.-'`'    -.  ;-;;,_
 |,4-  ) )-,_..;\ (  `'-'
'---''(_/--'  `-'\_)  Felix Lee
 
Did you make that ASCII by hand
 
of course. I signed it too (cwd.co.uk/asciimoo/view/20)
 
12:32 AM
Your name is Felix Lee?
 
Gullible's Travels
 
I thought it was Sehe "Polar" Bear
 
it's very much possible that you're up against the nemesis of every visual studio newbie: precompiled headers. remove the includes of "stdafx.h", and in the project properties dialog, under [Configuration Properties > C/C++ > Precompiled Headers], set "Precompiled Header" to "Not using precompiled headers". Then I suspect you'll get a whole slow of other, more real, errors. — Cheers and hth. - Alf 39 secs ago
^ It's not necessarily that problem, but I think it's funny how people don't notice such things.
 
@Cheersandhth.-Alf appropriate typo: 'a whole slow' :)
 
fixed already, thanks!
 
12:38 AM
Can someone please help this guy? I need to head home
0
Q: Returning std::map seems to not hold its values

DaveI have a call to a function which loads data from a file and returns a std::map. The problem is the value of the object is 0. But in the file i set it to 800, so something has gone wrong some where but i can't work out where or why. This is what i have in my main cpp file - the exit returns 0 w...

 
So you want him to suffer longer compile times on the already slow VS compiler?
 
@Rapptz you're apparently laboring under a misconception that precompiled headers speed up the compile times for a small project. they don't. what they do, is to waste programmers time (in this case student's time) searching for the cause of the non-standard behavior.
 
string null = "*";
KILL IT
KILL IT BEFORE IT LAYS EGGS
 
@Rapptz also, the MSVC compiler isn't slow.
 
2012 is better, yes.
2010 is pretty slow.
 
12:44 AM
I need to get 2012... if it really is that much faster at compiling.
Compile times are my nemesis.
*or rather linking times...
 
@Cicada what a good idea! it allows null strings to be communicated across CORBA connections. yay!
 
OpenMP is horrible, right?
I mean, programming with #pragmas looks wrong on so many levels.
 
hm i wouldn't know. 15 years ago...
 
@Mysticial 2012 does compile faster, at least as far as I can tell with my export-all-the-std::-and-personal-templates-for-this-dll-in-the-world Project I've got going on.
 
12:53 AM
I thought std::initializer_list wasn't finished yet in the first place?
 
> Alf P. Steinbach, except MS doesn't accept it
lol
 
it wasn't for the original 2012 VS
however, this is a compiler crash. it's wrong no matter whether the code is wrong. however, the code is correct. :-)
 
besides file location and name what other reasons can cause ifstream to return false ?
 
Currently locked by the OS, not sufficient rights, etc.
 
@Dave like, no such file?
 
12:57 AM
the location and name of the file is correct though but i still get a false
 
@Cicada It's nice. For some simplistic, coarse grained stuff. But I can't see me using it in 'durable' programs
 
@sehe What would you use instead
 
@Cicada I'm not sure. I've little experience with things outside pthreads/std::thread
But TBB/PPL sound nice
 
Xeo
@Cheersandhth.-Alf so, what was it about minimap and reduced repros? :P
 
@Dave What OS are you on? On UNIX, I'd use strace and inspect return codes of syscalls. ltrace for libc calls
 
1:00 AM
@Ell you around ?
im on windows 7
 
@Xeo i was wrong about the report being handled by competent person. instead of compiling, he or she looked at the code. instead of using command line compiler, he or she wants a visual studio project.
or could be the usual MS run-around
the "in 3 business days" thing indicates that it might be
in that case it's not an incompetent person
anyway, i catered to both possibilities in my response. :)
 
user1357851
There are a lot of busy but inefficient people
 
user1357851
the vicious ones kind of reminds me of snapping turtles
 
user1357851
they are slow and inefficient
 
user1357851
but if you point a finger in front of them
 
user1357851
1:10 AM
they will bite
 
@sehe They are extremely sweet.
 
user1357851
or use boost threading
 
user1357851
highly talked about but not so commonly used
 
is a tiny, pathetic speck compared to PPL.
 
@Telkitty wut? PPL or Boost?
 
user1357851
1:12 AM
boost
 
Okay. Might be true. For portable projects, I suspect Boost gets used as a phtreads facade
 
user1357851
TBB/PPL for lower levels?
 
lol, no.
TBB/PPL is the top level
then, about a mile below, boost::thread is like, a tiny RAII wrapper on pthread
 
yay i fixed the problem
 
user1357851
but most pthread already use RAII
 
1:24 AM
pthread = POSIX threads, is a C API
@Telkitty wut?
 
user1357851
use local mutex lock variable in functions so when the function ends the lock automatically unlocks (RAII)?
 
user1357851
I am talking about implementation of pthreading in C++ code
 
@Telkitty yeah. That's RAII. And very much not pthreads. That's Boost you're describing
@Telkitty Which one? stdlib? boost? Phtreads is a POSIX (opengroup?) standard and has nothng to do with that
 
user1357851
1:42 AM
anyone knows how to import contacts into a window's phone from iphone?
 
nope. And I'm off to bed - sleep well !
 
user1357851
@sehe laterz
 
2:11 AM
@sehe Sleep well.
 
user1357851
my window's phone and iphone refuse to talk to each other through bluetooth
 
user1357851
they can see each other
 
anyone know about bytecode
@te
@Telkitty are they set to discoverable ?
 
user1357851
yes
 
user1357851
they can see each other
 
user1357851
2:15 AM
and send info to each other
 
user1357851
I am trying to sync contacts
 
what can't they do then?_
 
Bytecode, also known as p-code (portable code), is a form of instruction set designed for efficient execution by a software interpreter. Unlike human-readable source code, bytecodes are compact numeric codes, constants, and references (normally numeric addresses) which encode the result of parsing and semantic analysis of things like type, scope, and nesting depths of program objects. They therefore allow much better performance than direct interpretation of source code. The name bytecode stems from instruction sets which have one-byte opcodes followed by optional parameters. Intermediat...
^ Procedure: double click the word in @taylor's message; select google in right click menu; click on first hit
 
OK I would like opinion on this if a bytecode program were loaded and converted to native then could it be linked with native code?
@Cheersandhth.-Alf thanks I already read this though
I'm just trying to find out if it could be linked
 
?
dunno what exactly you mean, but check out e.g. the boost python binding
 
2:21 AM
Bytecode -> converter/interrupter/JIT -> Native code -> CPU
native library could it link with it?
 
user1357851
@TaylorBioniks can not 'recognise'each other
 
user1357851
probably done on purpose
 
@Telkitty I don't know my android has a bit of a problem connecting to my computer but I cleaned the cache then it worked. Maybe try that
 
3:09 AM
What does the title of this chat room mean
Is it like lounge (general purpose) / c++ ?
or is that some sort of casting
 
Lounge for C++ users.
 
why not say c++ lounge then
 
@Droid Waving, "Not Drowning" I don't know I bet only the person who set it knows
 
I mean whats with the <>
 
It's the template notation
obv :P
 
3:11 AM
@Droid It's a play on syntax in C++
 
ah. good to know, thanks
 
For templated functions, I guess. That's how I always interpreted it.
 
Or classes
 
You can still talk here though, it's just no one likes to see drive by linking of another language.
 
haha ok
hey so is there anyway from browser developer tools that you can tell what the underlying technology of a website was built in
 
3:13 AM
Spoiler: HTML, CSS, JavaScript/PHP
 
im looking at music.google and from the url its looking like its built using mvc but i wonder if theres someway to confirm
whether thats ruby on rails or .net i dont really care
 
Ah you mean that.
Well sometimes they have a mention in the footer. Something like "Powered by Django"
.NET sites usually end in .aspx, though I don't think that's always the case.
 
yea I think when its mvc the file type is hidden
 
I think this ought to be the canonical C++ Hello World! program. However when Google for C++ Hello World programs it's a bit saddening.
Most versions do weird stuff like using namespace std; and return 0.
 
int main() {
    std::string s = "Hello World!";
    std::cout << s << std::endl;
}
:P
 
3:17 AM
whats wrong with return 0?
 
not required, plus it can be a bit too much to explain to a beginner.
 
but but... main returns int...
 
what is waving, not drowning btw
quick google search says its a music album?
 
So by adding using namespace std; and return 0 you have to explain two more things.
 
Also it looks like crap if you put all that in.
 
3:19 AM
using namespace std; is bs, I never use it. But returns 0; would make it more consistent for when functions are introduced.
 
Just say "main is a special function" and you wouldn't be lying. Because it's true.
 
i use using namespace concurrency; when doing C++ amp because its long to write but otherwise I don't
 
using namespace ridiculouslyLongNameSpaceForNoReason;
concurrency, really?
 
@Rapptz True but I prefer consitent rules thant mostly consitent rules with exceptions when introducing a language.
 
I try to shorten my namespaces to no more than 5 characters.
 
3:20 AM
@Rapptz Yeah it's the namespace for C++ Amp
 
Why not use namespace amp?
 
Ask Microsoft :P
 
Oh I probably don't have to. It's probably an old habit.
 
But concurrency makes sense when you consider that its a namespace containing things for doing parallel processing on both CPU and GPU. But amp would have been better (shorter and more "unique")
 
Concerning my Ideone-like web service. I wonder how I should store the files. Database, filesystem, vcs, memcache, ... Options are so many.
Btw, you can also compile like this: wget -O - -q --post-file=main.cpp http://stacked-crooked.com/compile.
It's a web-service basically. The webpage is only an example of a client application.
I think my roots as a desktop developer heavily influence my style of web development.
 
3:40 AM
Roflmao
I wanted to have a streamsize and streampos analagous for my engine,
and I wanted it to represent how big natively std::*streams could be opened
Like filestream
so I named it fword
 
rename it to fuck
 
Still, probably not as bad as wanting to name the Native size type of the machine (x86 v. x64) and saying 'Huh, I should call it native word, or nword'
The harmless things you do that you don't realize will offend the shit out of the next coder that comes along. :3c
 
Aarg, my editor allows me to but the cursor where no characters exist. If feels wrong.
 
Sounds kind've gross.
@Rapptz I would, but I decided to be sensible and just name is 'sword', for 'stream word'
I'm also trying to figure out how to get the unsigned analogous of steamsize and streamoff, but... Eh.
 
Ell
Hi guys
@stacked about that hello world thing, somebody advised me against endl. And to prefer \n . Can't remember why, maybe because endl doesn't flush immediately anyway
 
3:57 AM
@Ell because endl flushes and can cause your program to slow down from excess flushing
 
Hello
If I were to create a Socket Program between Windows and Linux, would I have to program a client and server for each operating system?
 
Xeo
This is C++. We have Boost. So no.
 
Sweet! Just what I was looking for
 
Xeo
And even without boost... no.
Just the socket implementations would differ
 
I thought I had to stick with basic winsocket and socket
 
Xeo
4:09 AM
And with a nice abstraction layer on top, you can use the same code all the way
(Which is basically what Boost.Asio does)
 
Say, guys.
Should I have it so my Stream class can perform a Peek() ?
Right now it's just set up to do strictly reading and writing.
 
Do you need it to?
A class interface should be no more no less than what you need. So if it's not necessary take it out.
 
Yes, but I was wondering if I should have ti at something as low as the Stream level, or if I should do it at the Reader level, where I can do Stream.ReadByte() and then Stream.Seek(-1)
Efficiency tells me that doing a Read and then a Seek multiple times just to do a simple byte-peek might not be the best way to go, but at the same time I don't think Peek is something all streams can do, including something like a TCPStream ...
Meh, what the hell. Why not: it'll be part of Stream
 
4:32 AM
Why was the std::next function added to the standard? What was wrong with std::advance?
 
4:49 AM
one is imperative, the other functional
 
Oh of course!
 
the "wrong" with imperative (command/action-oriented) is that it leads to verbose code that often conflicts with the Don't Repeat Yourself principle
on the other hand, expression-oriented code can sometimes be too terse to grok...
 
@Cheersandhth.-Alf yea I get it, I prefer functional programming when I can :).
silly me not noticing that a copy of the iterator is passed to std::next, and hence is non-destructive.
 
i think ++i is nice and idiomatic when it's enough
but as you say, sometimes needs non-destructive op
then a next operation saves introducing a temporary
 
Well I tend to prefer haskell or lisp when I can as I find thinking in those languages tend tends to be simpler. I usually run to C++ when I have to make things faster.
though the more I write in C++ the more I notice useful things in the stl.
 
4:56 AM
The stl is a treasure trove :)
 
std::move earlier this week saved me and since then I've kinda been checking out some of the other interesting features :)
well, more move constructors
The whole bypassing copies thing.
I'm sure I could have rewritten parts of the program to avoid unneeded copies and temporaries, but why bother when simply adding a move constructor to 3 classes drastically improved performance. :P
 
I'm so bored.
I'm pretty sure today has been the least productive day of my life.
 
go downvote some answers that have extended discussion
that always perplexes the authors
?
could also perhaps downvote answers with the word "red"
 
O.o
 
I'll.. pass.
 
5:02 AM
or, create an alliance on some social platform and upvote the most ridicolous answers
 
How do you make iterators work with containers with containers that have multiple ways to go through them? For example a tree and iterating in post-order or pre-order. I mean a container can only have one begin() and end().
and ... I bet someone has already asked this on so I dunno why I'm asking here. :P
 
the boost library has extensive support for that sort of thing, but i haven't used it
for the DIY, you can always just make a little reference wrapper the provides begin and end in terms of a particular pair on the underlying container
then you can write like
    for( auto&& x : inorder( mycontainer ) )
or you can get creative (like boost) and define some operator that provides a pseudo-pipe like notation
    for( auto&& x : mycontainer | inorder | without( '*bah' ) )
but since i haven't done that i can't attest to how practical it is
it's just an exercise that many c++ programmers like to engage in, creating small domain-specific languages out of the ordinary components of c++
 
5:25 AM
@Cheersandhth.-Alf ah interesting, the simpler version of it looks neat.
and sorry for the delay, I had Mathematica spaz out on me and freeze everything up.
 
wheres a good guide or example of wraping a basic object you made with the new operator using the RAII way?
 
@sabgenton you can use std::unique_ptr or std::shared_ptr as appropriate
 
oh ok so smart pointers?
@Cheersandhth.-Alf isn't it a good idea to stick it in a class an delete in in the destructor of that class too?
 
@sabgenton that's what the smart pointers do for you
when you centralize the implementation of that (which the smart pointers do), you can be more sure that the logic is correct. and you avoid having to write it all again and again.
 
ah ok so don't bother to make the class your self
 
5:37 AM
yes
:-)
 
kewl
I was looking at this sight on making a class for arrays but obviously (after your enlightenment you don't need this for class objects
@Cheersandhth.-Alf is this still the best approach for arrays? hi.baidu.com/otunpoqeuckstxr/item/898cd4c7223b0b2846d5c0fd
or do I use some smart thing there two..
 
You definitely do not want to use new[]. You certainly can use a smart pointer, but (IMO) don't gain a lot from it in this particular case.
 
@JerryCoffin did you read my link?
 
just adding to what @jerry says, you can use a std::vector if you want a resizable array, or a std::array for fixed size
 
ok your link is simlar concept though yeah, just no 'new' creation
 
5:44 AM
@sabgenton Glanced at it enough to think "ugh"...
 
lol
k
 
for the particular case of char array you can use a std::string
 
I will have to email this conversation to myself thanks :D
so any class you create you manage the objects with smartys
 
@Cheersandhth.-Alf ...or for wchar_t, std::wstring. I, however, have started to use std::vector<char> instead of std::string part of the time. The only real shortcoming is lack of support for I/O. Otherwise, it has a lot less built in, but standard algorithms can handle most of what's needed, often more cleanly at that.
 
5:55 AM
Does new[] always invoke the default constructor?
 
Is -1u valid syntax?
 
Not to my brain.
 
@StackedCrooked Does the unary - apply before or after the u?
 
@ThePhD If you use new T[size](); it value initializes.
 
I think not.
 
6:02 AM
@JerryCoffin Ah. Alright. I've been using new T[]; so far
Without any (), so I guess I'm okay.
@StackedCrooked What's the reason for the -1u though?
I mean, just looking at it makes my head hurt. Negative unsigned HNNNNNNNNNNNNGH.
 
Yes. Since `-` can't be part of a literal (§2.14.2: `decimal-literal:
nonzero-digit
decimal-literal digit`), it's `-(1u)`.
 
is there a way to click on this chat and get the link to it so I can come back to this point in conversation latter?
 
@ThePhD Fun!
 
Brain-hurting fun. @_____@
 
@StackedCrooked yes. the - is just an operator applied to the value specified by the literal
 
6:06 AM
Ah! Silly me :)
 
@JerryCoffin @Cheersandhth.-Alf some one I know who makes small c++ program says he hasn't bothered with smart pointers much (when not creating many object or anything like that) because VS tells him where he missed out a delete
Ok before you say boo
Is it ok for small programes where your not making like many object automaticly
(say boo if you like though)
 
@sabgenton It's a bad idea regardless of program size, at least IMO. I rarely use new directly any more -- and using new[] directly, well, it's been so long I honestly can't remember it.
 
really I saw smart pointers being used with new
 
@sabgenton i was going to say "create a bookmark", and that seems obvious, but it didn't work
 
what do you do for like objects created at run time?
 
6:11 AM
if you want to try it's on the room menu
also in the full transcript
 
ok
 
@sabgenton If you click the down-arrow at the left size of a message, the first item in the menu is to get a permalink. At least if memory serves, it takes you to that point in the conversation, not just that message by itself.
 
thought there would be an obvious way
 
maybe the bookmark name was invalid and it just failed silently
 
@JerryCoffin ah chears
 
6:13 AM
@sabgenton No problem.
 
Jerry what are some good ways to use new indirectly?
 
Seeing DeadMG's starred message about nobody abusing operator overloading reminded me of Bjarne's old gem.
@sabgenton With std::vector, std::string, std::deque, etc.
 
oh ok yup
I'm really a noob trying to catch up with others I know so I'll de 'new' myself eventually as I learn the library I need
probably shouldn't say such folly allowed
 
Wow.
@JerryCoffin Bjarne proposed some badass overloading, but it could've probably spiraled out of control.
Seriously? Phone off hook?
-Using actual phone characters?-
 
@ThePhD Did you notice the date on that paper?
 
6:24 AM
I did, but just seeing what he thought of
I mean, I'd say it looks fun as hell to be able to overload phone off hook.
 
@JerryCoffin Is there not some nice class in VC to do this for me? coderscentral.blogspot.com.au/2012/08/c-dynamic-arrays.html
(your before mentioned link on dynamic arrays)
 
@sabgenton Oh, it's pretty much a stripped-down imitation of std::vector. I wrote it mostly because people constantly ask about such things, not because I'd normally plan on writing my own for normal code.
 
Ok so just use vector
I should know that
 
@sabgenton I suppose if I ran into a serious problem with the std::vector in a standard library, it's possible I might try to write a better one, but I'd only do so at dire need.
 
 
1 hour later…
7:50 AM
Slight difference. I blame untyped printf for allowing mismatch :p
 
What do you guys think, should a library ask for a shared_ptr or just take a dumb pointer and internally convert it to a shared_ptr
 
@jozefg that depends
there are at least three cases
(1) conferring shared ownership to the library: pass a shared_ptr
(2) giving the library ownership: use unique_ptr formal arg
(3) library as just observer of something, use raw pointer
for example, sometimes overload resolution is such that in order to properly support string literals as arguments, you need to use char const* formal argument (or wide)
 
8:09 AM
@Cheersandhth.-Alf The library is a logger library, so it's taking in ptrs to classes which do stuff log messages (write them to files and such) so I would say it's a case of shared ownership... Alright thank you
 
8:24 AM
@jozefg shared_ptr should normally not be used in public interfaces
 
@StackedCrooked I'm just concerened with the user not understanding that the pointer has to live as long as the object does... I suppose thats their problem but i still have doubts about using a raw pointer
 
Getting ownership and lifetime right can be tricky at times.
 
Yes... And this is meant to be used by novices
 
Maybe people immediately recommend a shared_ptr/weak_ptr combination, but I think that's often more of a error-tolerance design.
 
So you would use a raw pointer then?
 
8:30 AM
Now, I would try to figure out what is wrong about my design.
 
I've been thinking about it for a while but I don't see an alternative to what i've got
 
Try to find the underlying problem pattern. And see if there are general solutions known for that case. I hope this makes sense...
 
Um it's 2:30 am here so thats probably not helping... "Problem Pattern"?
 
Btw, for a good discussion on shared_ptr see GoingNative video. Let me see if I can find it.
Ask Us Anything around 10-14 minute mark.
 
Great I'll check that out
 
8:39 AM
It starts at 11min.
 
Cool I'll take a look
 
8:53 AM
    void infoBox( String const& title, String const& msg )
    {
        TASKDIALOGCONFIG params     = {sizeof( params )};
        params.hInstance = GetModuleHandle( 0 );
        params.dwFlags = TDF_SIZE_TO_CONTENT;
        params.dwCommonButtons = TDCBF_OK_BUTTON;
        params.pszWindowTitle = title.cString();
        params.pszMainIcon = TD_INFORMATION_ICON;
        params.pszMainInstruction = L"Info:";
        params.pszContent = msg.cString();
        params.nDefaultButton = -1;
        HRESULT const hr = TaskDialogIndirect( &params, nullptr, nullptr, nullptr );
Ouch
 
 
2 hours later…
user1357851
10:36 AM
Yes, why Lounge<C++>, not <C++>Lounge
 
user1357851
or even <C>Lounge++
 
Good morning :)
 
user1357851
hulo
 
I am digging further into smart pointers.
However I am still a little bit skeptical, for example the composite patterns seems to be more difficult to realize than raw pointers.
 
I don't understand the difficulty.
Composite basically means:
struct item { std::vector<std::unique_ptr<item>> items; };
With item being the root base class.
 
10:42 AM
Well child parent
enable_shared_from_this
I wonder how this stuff works internally, I mean using it is easy..
 
It uses arcane magic that would have been outlawed if the government was aware of its existence.
^ Quite excellent.
You know what's fun to do? If you are using Google Chrome hold down the control key and press the N key many times rapidly. It will open new Windows like a mitraillette. The you can undo the process by pressing W rapidly.
 

« first day (756 days earlier)      last day (4185 days later) »