« first day (571 days earlier)      last day (4603 days later) » 

12:00
Is there any API DOC for C++, like there is for Java docjar.com/html/api/java
27
A: What happens to a declared, uninitialized variable in C? Does it have a value?

bdonlanStatic variables (file scope and function static) are initialized to zero: int x; // zero int y = 0; // also zero void foo() { static int x; // also zero } Non-static variables (local variables) are indeterminate. Reading them prior to assigning a value results in undefined behavior. voi...

@SerenityStackHolder Is cppreference.com what you want?
@RMartinhoFernandes T t; auto copy = t; is easily UB, how fun is that?
@LucDanton Hmm, not for PODs, right?
@awoodland Hmm. I think I'll need to check the spec. Lunch time now, though.
@RMartinhoFernandes Not sure actually :|
12:02
This looks promising. Thanks, R. Martinho.
(I was curious if it was the case with malloc/new for: stackoverflow.com/q/10515051/168175)
struct { int x; } could be fine where int isn't, yeah. ISTR to recall stupid rules when it comes to special representations.
int can't have trapping representations.
@thecoshman World of Warcraft?
12:04
Do typecast operators have to be overloaded inside the class?
apparently, these guys have worked out a way to make new virtual servers
Well that stinks.
Why?
A single argument constructor works for conversions too, if that helps in your case.
Id est, you can get a conversion with either A::operator B() or B::B(A).
@awoodland There's an answer further down that cites the C standard. It does not mention UB.
13
A: What happens to a declared, uninitialized variable in C? Does it have a value?

DigitalRoss0 if static or global, indeterminate if storage class is auto C has always been very specific about the initial values of objects. If global or static, they will be zeroed. If auto, the value is indeterminate. This was the case in pre-C89 compilers and was so specified by K&R and in DMR's o...

I believe C++ has similar rules.
So, I guess it's UB if the type allows trapping representations; an unspecified value otherwise.
Pointer types and characters types for those?
sbi
sbi
12:12
@Maxpm Yes, they have to. But you don't want them anyway. Implicit conversions aren't the root of all evil, but they are pretty far down towards the root, IYAM.
oooh, Hybrid Memory Cube, you can't sound much fancier then that :P
struct Foo
{
    int& Bar;
    // error: invalid initialization of reference of type ‘int&’ from expression of type ‘const int’
    // Why?
    Foo(const int Bar): Bar(Bar)
    {
    }
};
I would expect Bar to reference whatever was passed into the constructor.
Or is it saying that int& Bar has to be const int& Bar?
Wouldn't you want int& Bar in the constructor?
const int& won't work btw. Can't bind to int&.
@LucDanton Yes, I suppose I would.
@LucDanton Why not? ints have addresses. You could have a const int*.
Hey
12:21
@Maxpm that is going to copy by value the int passed in to a const int Bar, and then set your public Foo::Bar to be reference to that the temp copy
@Maxpm be careful of constructor parameters sharing the same name as the members
I'm wondering if I can build SDL for iPhone.
Any ideas?
I have no idea how to build something for iPhone that's just a bunch of .c files. Never did it before.
@Maxpm Basic const correctness. Suppose I have const int i = 0; and I do int& ref = i; as you suggest it should work. Then I can do ++ref;, and that's bad.
@thecoshman Oops. You're right.
is SDL designed to work with iPhone?
@Maxpm it's a rare treat :P
12:24
@thecoshman I googled and thought saw something about it working on the mailing list.
@Maxpm you constructor should just be Foo(int& valueForBar): Bar(valeForBar)
@thecoshman I'm really trying to build this: github.com/zodttd/gameboy4iphone
That emulator uses SDL.
that will take a non constant reference to the value passed in, which hopefully will not be a temp :P and set it to foo::bar
sbi
sbi
@Maxpm The Bar object passed to the constructor is a copy of what gets passed in. It goes out of scope the moment the constructor finishes. If you could bind it to a none-const reference, that reference would refer to a no longer existing object.
@Moshe does that not have a build script?
12:26
I couldn't find one for iOS.
Oh, wait... Maybe...
@sbi You can certainly do struct Bar { int& ref; Bar(int i): ref(i) {} };, no matter how silly.
@Moshe that says nothing about supporting ios
sbi
sbi
@LucDanton Oops. You can? Damn.
@thecoshman But it's an iPhone app, and I've seen it via Cydia.
@sbi The rule you're thinking of is for temporaries, which i isn't.
12:29
@LucDanton but if I call Bar(5) what is the value of Bar::ref?
@thecoshman You can't call it like that.
@LucDanton why not?
that's what the constructor says it takes, one int
No. It takes int&.
Prvalue won't bind to lvalue reference to non-const.
well, *value has been mentioned, which means I can no longer take part in this talk :(
perhaps one day I will get my head around them
Put another way, a C++03 reference (or C++11 lvalue reference) to non-const refers to an object, which 5 isn't.
sbi
sbi
12:31
@72con IME, in 99.9% the bug is mine, and not in some popular library, framework, API I am using. Of course, the tricky part is to stick to proving what is so probable, all the while you have the tempting thought that it might be someone else's fault.
FWIW, I have played with timers in Win16 in the mid-90s, and they worked fine. I doubt MS has managed to break that, because, if they had, all hell would have broken lose long ago.
@thecoshman Well you asked 'why not'.
@sbi; I'm 100% sure I'm doing something wrong :)
Kind of a joke blaming MS.. Maybe a bad one but still a joke :)
Putting it yet another way, if you want int& ref = 5; to be meaningful then in a way you're asking for &5 to be meaningful. So what's the address of five?
sbi
sbi
@72con If it's just a few lines, as you say, why don't you sanitize them, and wrap them in a proper SO question? If the question is good, you will very likely have a good answer within 10mins after posting the question.
@sbi yeah, I should do that..
12:34
@LucDanton but your constructor for Bar clear says it takes an int, not a reference to an int, not the address of an int, just the value of an int.
@thecoshman Oh sorry, wrong train of thought then! If thought this was about binding temporaries to refs once more.
How can I find where my OS put GCC?
So in the case of Bar(int) then this->ref is stale as soon as the constructor is done. If you touch it, then UB.
sbi
sbi
@LucDanton There's the story of an early implementation of some language (I forgot which) where literals were indeed stored in memory. Programs managed to write to those addresses, and thus the value of 0 might have become 42. It's all vaguely remembered hearsay, but I have heard that more than once, and seem to remember someone telling it from 1st-hand experience, so it might be true.
@sbi A case of Fortran.
sbi
sbi
12:36
@LucDanton Ah, FORTRAN, yes?
@sbi A particular implementation as I recall the story.
sbi
sbi
@LucDanton Yeah, that's what I heard, too.
@LucDanton that's what I thought
sounds like some sort of madness that Java would make use of, letting you change the value of constants
sbi
sbi
@LucDanton Actually, however, in the case of Bar(5), the Bar object itself is also gone the moment the ctor ends, so this isn't a problem.
@sbi oh mr pedantic :P
sbi
sbi
12:45
string.Empty, int.Zero, object.None … all equally stupid, yet using one of them is regularly defended as “more readable”. LOL.
Voldemort types in D‌​. Snort. What a wonderful name.
13:04
am I some sort of oddity for preferring long function and variable names that that make it more obvious what they do/are for?
I really hate seeing short hand names for things
sbi
sbi
Wts wrng w/ abbrvtns?
Seriously, though, some programmer use identifiers that read to me like they were dictating the code through clenched teeth. OTOH, I find it awkward if I have to break the simplest of lines because of hilariously long-winded identifiers. So, as always, moderation is the way to go. :)
what does 'Wts' mean?
what does 'wrng' mean?
what does 'w/' mean?
what does 'abbrvtns' mean?
what does the question mark mean in this context?
@sbi I would prefer line breaks over obfuscated code
Xeo
Xeo
I hate breaking up parameters. :/
It just starts looking awkward
sbi
sbi
@thecoshman Everyone would. It's just that programmers disagree about what code is obfuscated, and what code is merely taut and firm.
@sbi if you have to look at more then the line it is used on to get enough context to know what a variable/function is for/doing, it's obfuscated
user1174868
13:15
Just to cler things up, char can accept numbers but int cant accept characters?
Man, being stuck with only one screen sucks.
@EtiennedeMartel do less work
Xeo
Xeo
@EtiennedeMartel Slack less off
@thecoshman I mean, I can't slack on the chat and work at the same time.
@EtiennedeMartel then slack
user1174868
13:21
This program is acting strange, I am inputting numbers for char and it will sometimes accept the number, other times I get nothing
@Jordan are you wanting to say char one = 1 and have one equal the string "1"
sbi
sbi
@Xeo I dunno. It takes a bit more effort, but can be made quite readable. For example, (except for the identifiers, which I changed to protect the innocent), this is actual, working code from me:
template< class Foo_
        , int Bar_
        , int Baz_
        , class FooBar_
        , class FooBaz_ >
static void do_something( FooBaz_& foobaz
                        , const FooBar_& foobar
                        , blah blubb )
{
    Foo_::begin_doing();
    SomePolicy_::template do<Foo_,Bar_,Baz_>( foobaz
                                            , foobar
                                            , blubb );
    do_yet_more<Foo_>(foobaz, typename Foo_::some_templ_bool());
    Foo_::end_doing();
user1174868
I am just studying for a test...anyways I have char x int y and cin >> x >> y and I input a54 and it outputs a 54, input 54 and it outputs 5 4 sometimes
user1174868
but if I input 554 nothing happens
sbi
sbi
@thecoshman Why? Horizontal space easy to have. See the code above.
Xeo
Xeo
13:23
@sbi Sure it can be made readable, but I don't know.. I just don't like splitting them up, I guess
@Jordan lol, char doesn't go that big
user1174868
so char can accept numbers, just single digit ones?
oh, well it's taking the first character, so that character 5, not the numerical value 5
user1174868
In general this program acts very strangely
user1174868
If I enter 534 I get nothing, but if I enter 543a I get 5 43 a
user1174868
13:25
I have a z char too
user406009
@Jordan I think you are wrong about that 544 doing nothing. ideone.com/fCy7m
@StackedCrooked Yes.
user1174868
I have char x int y char z cin >> x >> y >> z
sbi
sbi
@Xeo The longest type in that snippet is FooBaz_. In the real code, it's all types like blahblubb_policy_base. If you write such code without wrapping the lines, you need a 1920 pixel wide monitor and a small font, and you forgo the chance to put code windows beside each other. I don't think the old 80 chars line limit makes sense anymore, but no matter what you settle on, it will always be too small for template-heavy code,
the int y will gobble all until it get's to a non number
13:27
If you enter 534 you don't "get nothing", it's waiting for more input.
user1174868
cin >> x >> y >> z;
cout << x << " " << y << " "<< z;
user1174868
oh
Input in streams is greedy.
user1174868
I get it now
Xeo
Xeo
@sbi Incidentially, if I have to split up code, the 80 char limit is what I usually go for. I dunno why, really, it just feels natural for some reason.
sbi
sbi
13:28
@Jordan The size of a char on your platform is determined by CHAR_BITS, a macro from the C standard library. The standard implies that it must be at least 8 bit. That makes for numbers between 0..255.
because so many things still think we only have 5" screens
Well, greediness is actually irrelevant. It waits for input for z, anyway.
std::copy(std::istream_iterator<int>(std::cin), (std::istream_iterator<int>()),
                std::ostream_iterator<int>(std::cout, " "));
120 characters is better than 80 characters.
@Jordan ^ to make it non-greedy
13:29
@CatPlusPlus With operator>, sure.
user406009
@Jordan And the chars are not really reading in "numbers" from the standard input. They are reading in the character of a number digit.
@CatPlusPlus well, the greediness is that y keep's taking in the digits, thus z never gets a turn
@thecoshman I assume he presses Enter after 543.
@CatPlusPlus oh yeah :P
user1174868
so is the difference that a int stores a binary value of the input and char stores the ascii input or something?
sbi
sbi
13:30
@thecoshman The only valid reason I have heard for that is that some programmers sometimes end up at some system at a customer's where vi is the only available editor. If this happens regularly, teams might decide that wrapping at the 80th column is worth the trouble.
never used cin for more then one thing at a time
Which flushes input into y, and then waits for another character for z.
Because whitespace does that.
@Jordan yeah, char wants to deal with characters
operator>>(istream, int) does string->int conversion for you.
thus if you print a char with a value of something like 50 you get a letter (fairly sure it's around the upper case zone)
13:31
(And also fails early on non-numeric input, but that's another story.)
user1174868
I have learned c++ completely wrong, I can't even recognize code without using namspace std
Yes, you have.
Unlearn and relearn.
user1174868
I have to learn scheme now for school, I will relearn c++ eventually though
@Jordan I had similar problems when I first learnt
sbi
sbi
@Jordan If you want to properly learn C++, make your pick from this list.
13:33
@Jordan as in, having the line using namespace std or writting std:: ever where?
user1174868
I got bjarne's book actually
user1174868
using namespace std
using namespace std is a tutorial-transmitted disease.
@CatPlusPlus ironically, so is not using your own namespace
that is one thing I think java has done well, it really really really works hard at making you use packages, which are a close parallel
There is nothing wrong with using namespace std per se. The problem happens when people just dump it at global scope. Even worse if it's in a header file.
13:36
You're not supposed to sue any namespace. What have they done to you?
@CatPlusPlus sorry, must have come over all 'mercan
I don't use my own namespaces.
@CatPlusPlus stop polluting
¬_¬ stupid comment // will always be <this type> right after, handling other type
@CatPlusPlus You use the global namespace?
Oh, wait, you mean you don't using namespace your::own::namespaces?
@RMartinhoFernandes oh well, you see, he's a cat, so to him, it is his name namespace
13:41
@thecoshman ?
@sehe you don't have a cat do you
@sbi You can hack that in Java Integers with reflection (it's an implementation-dependent hack, though)
May 1 at 13:49, by sehe
Speaking of cats, we just 'bought' adopted one
@sehe nope, you got selected to by the cat to be it's 'owner'
Also, I have had cats all my life. The previous one simply retired at 16 yrs/old
@thecoshman There is no satisfying a troll
13:45
@thecoshman Exactly.
That's how DF pet mechanics work for cats. Realism is something the game strives for.
Random commit message generator: http://whatthecommit.com/
3
@RMartinhoFernandes so that's where all the commit messages here come from
> put code that worked where the code that didn't used to be
This one is awesome.
> a few bits tried to escape, but we caught them
> Reticulating Splines
> spinning up the hamster
@SamDeHaan you need to use a '>' followed by a space then your message :P
@thecoshman Thanks :P.
13:50
@RMartinhoFernandes Yes.
> fixed the israeli-palestinian conflict
:O
> To those I leave behind, good luck!
@RMartinhoFernandes love that
> one more time, with feeling
Seriously, I'm gonna use some of those.
> /sigh
oh yeah, may as well :P
user406009
13:52
| (\ /)
| (O.o)
| (> <) Bunny approves these changes.
You didn't know that thing?
sbi
sbi
@RMartinhoFernandes Whoa! Incredibly good!
> Don't push this commit
sbi
sbi
> Gross hack because @Tony doesn't know how to code :)
WTF, the name is randomized, too!? Why then is that called a "permalink"?
14:02
It's not hardcore permalink.,
> This is the last time we let Cord commit ascii porn in the comments.
2
> FONDLED THE CODE
@TonyTheLion Sam mentioned porn. Welcome!
who is sam?
Say porn three times and he comes.
sbi
sbi
14:12
@SamDeHaan Permalink or it didn't happen.
sbi
sbi
I sent the link to all the developers here, and it was welcomed enthusiastically. One of them suggested putting a hook into Tortoise that invokes the thing to fill the commit message automagically. That proposal met a lot of approval.
sbi
sbi
@sehe Yeah, but look at the first two comments regarding this at Schneier's blog.
Anyway, need to leave. afk
@sbi Looks like I need to be more unproductive and mash refresh until I get a permalink.
Damn. I spoke too soon, looks like I don't have an excuse to be unproductive. link
> This is the last time we let Tony commit ascii porn in the comments.
5
@sehe Nooooooes! Y U TAKE ALL FUN OUT OF IT?
@RMartinhoFernandes Wrong premises
@CatPlusPlus Sounds legit.
14:17
> Become a programmer, they said. It'll be fun, they said.
Q: Is being a computer programmer fun?
A: NO
Source: Took programming in college. It sucked.
If your fat
Source(s):
yes
Also, sleep. Bye.
Sleep is fun, waking up is crap. Especially if you get stuck in a weird half-awake, half-dreaming state for several minutes that feel like forever.
I don't know what the fuck, but it happens. :<
in Discussion between sehe and remio, 49 mins ago, by sehe
@remio Take your time. I think you learned plenty for today.
^ a bit of time wasting I think you'll be able to appreciate
14:24
@sehe Milking me for upvotes on your niche topics ;)?
@RMartinhoFernandes Oh. Don't bother. I thought vim wankery interested you :)
I guess you did still. It always surprises me how hard it is to get operator pending mappings and vmap/xmap working correctly
@sehe :) And to prove I actually read it, I fixed a mistake too.
Good spot!
Can you tell q is my default scratch mapping reqister? I invoke it with @@ so I get used to qq, @@ so much
yo nubs
@sehe I bet that's true for many.
I think it's natural, since just going with qq is... well, easier.
14:32
@RMartinhoFernandes I think it is alo propagated by some vimdoc/tutorials
I'm surprised that the question has three close votes: one for belongs on superuser (fuck these people, vim is a programmer's tool; go read the damn FAQ; should we move VS questions to superuser?); one for not a real question (I hate it when people treat NARQ as "too difficult for me"); and one for too localized.
@RMartinhoFernandes vim is a torture tool, not a programmers tool
@thecoshman You think those two are exclusive? Want me to cite examples?
Autotools. Cmake. Eclipse. PHP.
@RMartinhoFernandes no, no I do not want examples
why ask if you are just going post them any way (╯°□°)╯︵ ┻━┻
A rhetorical question is a figure of speech in the form of a question that is asked in order to make a point and without the expectation of a reply. The question is used as a rhetorical device, posed for the sake of encouraging its listener to consider a message or viewpoint. Though these are technically questions, they do not always require a question mark. For example, the question, "Can you do anything right?" is asked not to literally evaluate the abilities of the person being spoken to, but rather to insinuate that the person always fails. While sometimes amusing and even humorous, r...
14:40
@RMartinhoFernandes screw your rhetorical questions
@thecoshman Is that even biologically possible?
@thecoshman: Why a torture tool ?
Because he can't use it properly.
0
Q: Mimic ON_UPDATE_COMMAND_UI

XaadeMy problem is that I have code I cannot modify that reacts to ON_UPDATE_COMMAND_UI, and I've hosted the code in WinForms, so it's not routing the messages correctly. I've hooked into the Idle override in my winform host, but I don't know how to mimic the message. If I wanted to mimic ON_UPDATE_...

That wouldn't make it a "torture" tool, just a tool difficult to learn. :)
14:51
@thecoshman calm calm boy
What do you guys think of the Dev-C++ fork this guy made? orwellengine.blogspot.pt Should we stop "mandating" a switch and consider an update to this version acceptable? It now packs a recent GCC and the maintainer seems eager in fixing bugs (though I have no idea of the general state of the thing bugwise; and it's not like VC or CodeBlocks or Eclipse are not bugless).
user784668
@RMartinhoFernandes One word: vim.
No, as much as I love I'm not going to tell people to switch to it instead of using their favourite IDE.
@RMartinhoFernandes My feeling so far was worth a shot, it clearly fills a useful niche
I'm just going to suggest they stop using the old Dev-C++, as it is incredibly outdated and buggy.
And vim is likely not a good alternative to Dev-C++, as the target audience is totally different.
14:58
I get that vim is a powerful text editor, but that is all it is. sure you can quickly do commands like run your build. but it't not an IDE
yes yes, an IDE might abstract things away and not do things 'perfectly' but fuck of with those stupid arguments. I don't have time to twat around with build scripts and the shit
My doubt is only whether this Dev-C++ 5 is a decent alternative.
user784668
@RMartinhoFernandes Compared to 4.9.9.2? Sure.
@RMartinhoFernandes It's made by a dutch guy, AFAICT, that's a good thing. For the rest, it still comes with 'hard' dependencies, and GCC 4.6.1 isn't really uptodate

« first day (571 days earlier)      last day (4603 days later) »