« first day (94 days earlier)      last day (4847 days later) » 
00:00 - 23:0023:00 - 00:00

12:21 AM
@AlfPSteinbach @A
@AlfPSteinbach I'll try again shall I. Sometimes a long, well written answer gets more votes overall than the fastest gun in the west...
 
12:34 AM
question counter is at 1,234,462 . we'll reach magic number soon!
 
isn't it already past?
 
 
2 hours later…
2:39 AM
Hi folks
anyone have a moment to talk about variadic methods?
 
Kyle what do you need
 
is there a way to write the method to only accept objects of a specific type without just handling it within the method itself?
(technically I'm working in Obj-C, but I'm the only one in that room)
 
2:42 AM
dunno objc
 
why wouldn't you want to handle it inside the method?
 
should be very similar if there is a way.
laziness
 
im sure you can test as soon as the method gets called with typedef()
wait no dont listen to that
looking it up now
 
too late, already googled it.
I'll better explain what I want to do.
 
kk
so you want to be able to pass an object to a function, and if the object is not of the type you expect you want it to throw an exception?
 
2:46 AM
I would like to have a method that initializes an object differently based on a list of enumerated values, something like ObjectName *myObject = [[ObjectName alloc] initWithMediaTypes:MediaTypeA, MediaTypeB, MediaTypeD];
right now, just returning nil would work. Preliminary stuff.
 
overloaded functions? don't know obj c at all, can't help
 
thanks anyway
 
sorry :P
 
I think I'll just end up checking the va_list for correct types and throw an exception if the programmer enters a value that is nonsensical.
 
 
2 hours later…
5:07 AM
@Kyle: in C++, if I understand you correctly (all those values are of the same enum type?), you'd either accept a variable number of values (e.g. pass a container or iterator pair) or overload on a small varying number of parameters; more usually the former, but perhaps the latter in some specific situations
don't know if that helps you in objc
 
5:57 AM
i want a new badge
 
sbi
6:14 AM
@AlfPSteinbach <hint> That's what stars are for. </hint> :)
 
6:33 AM
@sbi hidden in the full text link (which displays it brokenly), but worth its length in gold: "But what made those who had laughed at me stop laughing was when, after several days, it became obvious that some several very hard to reproduce bugs which a few of my coworkers were desperately looking for had disappeared."
 
6:45 AM
@sbi: hope you don't mind me adding that comment, but the short story goes well with your answer
 
 
5 hours later…
11:23 AM
lol @tina you have a private room with alf?
 
12:18 PM
hi all
 
1:15 PM
@Nils hello
 
1:30 PM
Should a class need to be a template class for its member function to be a template function ?
 
sbi
1:42 PM
@Mahesh It's class template (a template from which classes can be instantiated) and function template (a template from which functions can be instantiated, and, no, it doesn't. Classes can have member function templates.
(Ordinary classes, in case that's clearer.)
Oh scratch that, I think it's just that the most-upvoted answer is wrong...
 
2:31 PM
@sbi: the highest scored answer being wrong seems common today
also, the distinction between "class template" and "template class", which I also used to follow closely, seems like nothing more than terminological masturbation for us pedants
someone even pointed out (sorry, no link or refs handy) how the standard uses the two inconsistently
 
2:48 PM
I think it should be called a template class
because when you define one, first you write template, and then class
 
sbi
@DeadMG Of course, that makes perfect sense. It's, after all, why "table cloth" (where you first write "table", and then "cloth") is a table that is clothed and not a cloth, that is tabled...
 
exactly
oh wait
now I'm confused
 
sbi
@FredNurk I used to think the same, until I realized that people consider templates to be types, and wonder when this wouldn't compile.
 
well, just like with const, the problem is with those people :)
 
table cloth is an old word
 
sbi
2:56 PM
@DeadMG Oh, are you? I'm soo sorry, that really wasn't my intention!
 
no wait
that's your fault
tablecloth is not two words
 
@sbi I'd hang my dirty old socks, maybe... but certainly nothing more valuable, on the reliability of interpreting technical terms according to analogy with English words
 
sbi
@FredNurk Whatever you hang on it, in English, as in German (where I even new the correct grammatical terms) when you string two nouns together (no matter whether you put a space between them), the second word is what the thing described is, and the first one puts it into a sub category. Cupboard, tablecloth, redwood, water bottle...
Which is why the proper name is class template, not template class.
 
except a cupboard doesn't describe anything to do with a board
nor a cup
more properly, I would argue that the fact that it's a template is more important than the fact that it's a class
rather than the other way around
 
sbi
@DeadMG Are you trying to be obtuse? (If not: It used to be just a board on the kitchen wall.)
 
3:02 PM
that's my point
the important part of that sentence is "used to be"
as in, that is what occurred in "the past", where it is meaningless
I speak English in 2011, not 1800
 
sbi
@DeadMG <shrug/> So strike that example and take one of the others. Really, everybody can come up with dozens of them in a few seconds.
 
ok
so now you think that technological names should be as in natural language?
why do we even have a periodic table or formal language or anything like that? let's just use English
not that I personally would object, but hey
 
@sbi which should show you the value of any such list of examples or counter-examples
 
more importantly
 
sbi
@DeadMG Good example. A "periodic table" is a table. And a "class template" is a template.
 
3:04 PM
I feel that classes are a subset of templates, not that templates are a subset of classes
 
@sbi: what is "vector<int>"?
 
being as how template classes without template arguments are infact not classes at all
 
sbi
@FredNurk A type.
 
cop-out
 
no, I agree with @sbi here
 
sbi
3:05 PM
@DeadMG Then IMO you feel wrong.
 
vector<int> is a perfectly valid type and has no reason to be anything else
 
@DeadMG: that answer is a cop-out
 
sbi
Neither is a subset of the other one.
@FredNurk Whatever that means.
 
Cop out is an idiom meaning (as a verb) to avoid taking responsibility for an action, avoid fulfilling a duty or does not fulfill expectations or (as a noun) something which 'cops out'. Cop out or cop-out may also refer to: * Cop-Out (play), a 1969 Broadway play starring Linda Lavin * Cop-Out (video game), a 1986 video game by Raffaele Cecco *Cop Out, a 1969 book by Ellery Queen * Cop Out (book), a 1999 biography about the rugby 1981 Springbok Tour by Glenn Wood Film and television *Cop Out (2010 film), a comedy film directed by Kevin Smith and starring Bruce Willis, Tracy Morgan and Ke...
 
actually
you're right, @sbi, what I said was completely wrong
I feel that the distinction between classes and functions in terms of what can and cannot be done with them is stupid and should never even be here
a template is a template, regardless of what is being templated at hand
 
3:08 PM
anyway, I too had fun with the 'template class' masturbation in years past, as I said, but it really doesn't help anyone, just like some people bring up "stdlib != STL" on every question that includes capital ess, tee, and ell letters.
 
actually
I had an idea for DeadMG++ where you could template member variables
 
sbi
@FredNurk Actually, it does help. When I taught C++, my students (thrown at me after a year of Java) always had problems to wrap their head around the fact that a template is not a type, but something from which types are created at compile-time. (I think these problems come from what generics are in Java, but I don't know Java.) I found the way to make them understand this was to insist on it not being a (template) class, but a (class) template, from which classes can be generated.
Before that, I didn't care much either, and used the wrong term regularly.
(Oh, and I don't masturbate. I do know it makes you blind. True, I have to wear glasses, but I did find a way out. Only that now I have way too many kids...)
 
it was a euphemism
 
sbi
@FredNurk I didn't know that. :)
 
much of that is harsher than I usually see it used
a fairly simple analogy by the physical act being something you do "for your own good, and no one else's"
 
sbi
3:18 PM
@FredNurk <sigh/> It's no fun when you try to wind up someone and they fall for it completely.
Maybe I should have added a smiley?
 
@sbi it's late, I'm tired, and you're including how you explain english terms to foreign language speakers, so yeah *shrug*
 
sbi
But then, the "way too many kids" wouldn't actually need a smiley, no?
@FredNurk OMG. What timezone are you in?
 
late on my personal time :)
 
sbi
What's your local time?
 
half past 10, but that doesn't mean I've had any sleep lately :)
 
sbi
3:20 PM
am/pm?
 
am
 
sbi
Well, 10pm is only "late" to a farmer who has to get up at 4 in the morning. :)
 
3:34 PM
lol
 
3:57 PM
yawn
Excuse me.
 
4:24 PM
am I seriously misunderstanding something here? stackoverflow.com/questions/4725664/…
he switches on a value that can never be anything different
it's like int x; if (x is an int) cout << "It's working!";
 
yes
you're not misunderstanding the code, what he's done is very silly
here's a question
if I'm a student and I get Visual Studio for free for being such from Microsoft
does that mean I'd have to actually buy it if I wanted to sell a game I wrote in it?
 
get legal advice from lawyers
 
f that
do you know how expensive tht is?
 
yes
is this hypothetical game worth selling?
 
@DeadMG Until ~2 years ago commercial usage of Visual Studio for students was explicitly allowed but I believe they changed the EULA
 
4:28 PM
hm
I'll have to read it again
 
not all conditions in that EULA (as in most EULAs) are enforceable, too
in fact, I'd venture to say anything that calls itself an "EULA" is 99.9% guaranteed to have unenforcable conditions :)
 
I think it's quite likely that they can enforce non-commercial use
check out my epic textures for my main menu buttons
the filename is programmerart.jpg
which I feel to be rather accurate
 
why do people worry so much about problems that boil down to "My problem is that a compiler allows constructs such as: strcpy(0, "boomstick") How will we ever live if we don't prevent this?"
 
exactly
protect against Murphy, not Machiavelli
3
 
I really like that line
 
4:37 PM
me too
here's an interesting question
how do you debug a call to memcpy() when you never called it
 
backtrace and see what did call it
 
I'm looking at my callstack
fatal exception in memcpy()
next function down
a constructor which most definitely does not call memcpy
 
do you have UB from stack corruption?
 
no
 
but it contains an object which itself calls it in the constructor, perhaps?
 
4:40 PM
it turns out that I accidentally tried to remove a pointer in the add pointer function and vice versa
how the compiler changed
vector.erase(std::find(vector.begin(), vector.end(), ptr)) into memcpy I have no idea
also, I thought that construct should be valid if the vector is empty or if ptr isn't found
 
you're missing the vector.end() parameter to erase :) but for POD types, memcpy would be the preferred implementation for many vector methods
 
yeah, I get that part
but for erase()?
 
sure, why not erase?
 
well I guess you could memcpy across
 
say you have [X..XABCD] and you erase all the Xs (and there are more Xs than others, so the memory ranges don't overlap); you'd memcpy A-D to the front of the vector, then set the end pointer to point right after D
if there overlap, use memmove rather than memcpy
 
4:45 PM
hmms
I think I fucked my button code :(
 
oh, d'oh, I'm thinking 2-parameter version instead of 1; same thing applies, just on a smaller scale
 
5:08 PM
here's a question
how can hit testing be off in one dimension but not another
given that they use the same logic
 
5:21 PM
floating point?
 
@DeadMG Obviously you should check the EULA, but are you using anything that can't be done with the Express edition? The Express editions can be used for commercial software and are free.
 
5:41 PM
yeah, I was thinking that
but then, doesn't that imply that Icould just recompile in Express when I'm finished and circumvent the EULA that way?
 
IANAL.
 
?
 
I am not a lawyer, and I really don't want to speculate on that :-D. I'd check the EULA. Usually the "no commercial use" restriction is pretty clearly stated near the top of the license agreement.
 
I do think however that Microsoft is very kind to go giving away the Ultimate editions of their most recent compiler for free to students
turns out that GetCursorPos is not actually terrifically helpful
 
5:57 PM
@DeadMG that depends on many things and is, afaik, untested in any jurisdiction; analogy in law is especially heinous, but compare to buying a vehicle with the seller trying to license (not contract, an EULA is not a contract) you to only non-commercial use
@DeadMG: especially in the case of recompiling (so we don't have to consider pulling in runtime library code), the code you write in an editor is not automatically a derived work of that editor – this normally applies to "viral" licenses such as the GPL, but eliminates another way an EULA could try to restrict you
@DeadMG "kind" is not the word; the first hit's free to get 'em hooked young — this is not inherently bad, it's good business practice; just remember it's a business decision rather than a kindness
after all, what is the value to a publisher when most of the prospective recently graduated users only know how to use your product?
 
6:13 PM
there is that
 
 
1 hour later…
7:25 PM
there's something wrong with me
I made a button to debug my button code
now I can't stop causing fatal errors clicking it :P
 
0x's strategy of typedef decltype(nullptr) nullptr_t to the rescue
 
omgwtfROFL
ok, interesting question about exceptions as control flow
I want to terminate my program and call all destructors along the way
I tried using exit() but it of course does not call any destructors
is using an exception a Bad Thing™?
 
I already read them
was questioning about my use of exceptions as a control flow
since I know of no other control flow construct that can unwind my entire call stack at once regardless of where it's used from
 
struct SystemExit { int code; SystemExit(int code) : code (code) {} }; void system_exit(int code = 0) { throw SystemExit(code); } ... int main() try { /*normal main body*/ } except (SystemExit &e) { return e.code; } except (std::exception &e) { std::clog << e.what() << std::endl; return 1; } except (...) { std::cerr << "(unknown exception)\n"; return 1; }
 
7:35 PM
something like that
 
each thread's main function should have something similar
@DeadMG yeah, whenever I type up code longer than 5 lines from memory, "something like that" should be assumed :)
 
so using an exception to signal program termination even in normal conditions is fine?
 
it indicates a design flaw, but it's certainly possible
the = 0 should probably be = 1, or even omit the default
 
well
I don't see any other alternative design
program exit from an arbitrary point in the call stack- but with all destructors called?
 
why is it an arbitrary point?
 
7:39 PM
because it could occur in any callback or any error condition?
for all I know, you might want to exit if the mouse moves
 
7:51 PM
why does an error condition count as "normal conditions"?
if a callback throws an exception, why are you questioning the callback's motivation? if you're writing a callback, then you have control and get to decide whether to throw, but in that case, again, it's either a design flaw of the code calling you that you must resort to an exception for what you consider "normal flow", or you're introducing a design flaw by throwing instead of using normal flow to exit normally
 
@DeadMG Terminating with full cleanup can be problematic in some cases, because the assumptions of cleanup code may be invalid (due to reason for terminating). I remember long debates on this. There is a formalistic view, mistaken as I see it, that when bug is detected, nothing that involves assumptions about programs' own state can be relied on any more.
 
depends on the bug
 
8:07 PM
@JohannesSchaublitb: thanks for posting that, felt like I wasn't getting through to anyone
 
8:27 PM
my text
it disappeared :(
 
9:09 PM
Is this strictly valid since the object is not an array?
 
I believe not
the Standard only defines one-past-the-end for arrays
 
9:55 PM
§5.7/4 "For the purposes of these operators, a pointer to a nonarray object behaves the same as a pointer to the first element of an array of length one"
Wouldn't make sense if all you could do was add or subtract 0.
So, it's OK.
 
I thought that was common knowledge; the standard quote, not the appeal to implementation characteristics (which is nevertheless a valid line of reasoning if you have specific implementations in mind)
 
10:46 PM
apparently the SO moderator nominations are up
but nobody from the C++ community?
 
@DeadMG It's funny how people nominate themselves. Must be some US influence.
 
I've nothing against self-nomination, but imo people should be mainly nominated by others
but hey, we need a C++ moderator :P
 
There are a few people I'd like to nominate, but in this election, you can only nominate yourself, not someone else.
 
I personally would probably nominate sbi
 
10:56 PM
I would like to moderate.
But there are soooo many individuals already nomitated with much more rep than I do..
 
rofl
karlphillip, I wouldn't be put off
 
sbi
@DeadMG Oh please, no. I haven't done anything to deserve moderation power. I'm very good at polarizing, not moderating, people in discussions.
 
from the tone of the other nominations, I suspect that a lot of them are for specific subregions
like there was that guy that was like, well, I do iPhone stuff mostly
 
@sbi I think you'd make a good moderator.
 
@DeadMG DeadMG you should nominate yourself, dude. We need a C++ moderator.
 
10:59 PM
uh
I'm not too sure that I qualify as a moderator
 
00:00 - 23:0023:00 - 00:00

« first day (94 days earlier)      last day (4847 days later) »