« first day (563 days earlier)      last day (4390 days later) » 

9:00 PM
@user908041 it is incorrect. Why does each MyClass have it's own myObj, but getActiveInstance is static. What's the intent here?
 
ah no, I take everything back
 
@user908041 looks like you want this
 
Oh right, well @MooingDuck the basic idea was to just be able to use 1 object the entire time. Would that one function essentially replace the need for a class here entirely?
 
@user908041 yes
 
Aha, this makes sense too :>
 
9:02 PM
Is there someplace I can read about C++11 unions?
 
right thanks @MooingDuck, I shall continue to tinker (and in due course, break stuff)
 
Ell
but you can still write the function as a static function of the class and call it getinstance
 
I want to join the union :)
 
@user908041 if you're using a singleton, you probably want a namespace
 
@CatPlusPlus: I was also thinking about a DF-clone, but I was going to focus on graphics and the learning curve. I had high hopes for a moment when I saw your goblin camp, then they were shattered.
 
9:03 PM
@Pubby §9.5. :)
 
@SethCarnegie not quite a singleton I don't think.
 
@MooingDuck GC is not my project.
 
@CatPlusPlus oh. Still.
 
And it's in rather bad shape currently.
 
other than the fact that it's designed wrong, who can tell me why this dies? ideone.com/hX6B0
 
9:03 PM
@GManNickG I said read, not kill myself
 
But I lack energy to revive it.
 
@stdOrgnlDave threading is complicated :( I hear there's "memory barriers" that may or may not be relevant.
 
async isn't implemented?
 
@MooingDuck I know, I write multi-threaded applications. are memory barriers actually applicable here?
 
@stdOrgnlDave haven't the foggiest idea what a memory barrier is, so I don't know
 
9:05 PM
async is for babies
 
Also, infinite loop.
 
@RMartinhoFernandes also that
 
yeah, infinite loop shouldn't matter, it's set to launch my lambda
damn what header is async in in VS
 
@CatPlusPlus I get intimidated since my experience with graphics is quite minimal, and even then I managed to destroy my framerate.
 
I thought this might help: ideone.com/Ny08M Turns out it, didn't.
 
9:07 PM
ok, is this good?
 
@RMartinhoFernandes There should probably be a break after "YEAH"
 
sthe output is "generic:1"
that is so unhelpful
 
Why does it throw?
 
GCC fails at it so bad that it can't even figure out why it's failing
 
Wow
has anyone seen VS11 beta
where did all the colour go
 
9:09 PM
btw @MooingDuck, wouldn't that snippet need to return obj&? or does Obj& gimme_the_obj return a reference already
 
@user908041 you have to make the variable Obj& or it will be copied.
 
@stdOrgnlDave Are you sure std::async is implemented?
 
ok thanks @SethCarnegie
 
@user908041 you return obj, which returns the object by reference. The signature is Obj&.
 
oh of course
 
9:10 PM
Android rewritten in C#, to avoid those pesky lawsuits. http://blog.xamarin.com/2012/05/01/android-in-c-sharp/
 
@MooingDuck Make it work. Make it fast.
 
What's the lawsuit over?
 
well, first my code made the program not work. I backed out my code and the program still doesn't work. This isn't good.
 
Unlicensed use of Java, IIRC.
 
9:12 PM
@stdOrgnlDave did you compile with -pthread?
 
I don't own ideone! I can't compile with anything!
and VC2k10 doesn't have async
no access to anything other than ideone and geordi-bot on IRC atm
 
you need -pthread anyway, else bad things will happen
 
@RMartinhoFernandes page not available
 
Yup, works fine with pthread.
@MooingDuck Hmm, works fine here.
 
@RMartinhoFernandes I can view the tweet, but not the page he links to
 
9:15 PM
Corporate crapwall?
 
@RMartinhoFernandes you're saying, with -pthread that code works fine? coolness
 
Ell
is -pthread on windows?
 
if I use alloca inside a lambda, does that memory go in the lambda's stack or in the surrounding function's stack?
@Ell pthreads is POSIX threads
 
Ell
ahh kk
 
@stdOrgnlDave Does it really matter?
 
9:17 PM
@Pubby yes.
 
@stdOrgnlDave Why? :S
 
wow,
it gets done in the stack of whatever made the lambda
 
I doubt that.
 
What? That doesn't make any sense.
 
both VC and GCC show the same behavior
 
9:21 PM
What behaviour?
The undefined one?
 
@RMartinhoFernandes can you have a look at this, is anything wrong with it? stackoverflow.com/a/10396012/893693
 
no, the one where it alloca's on main's stack
 
@stdOrgnlDave you're displaying variables that were local to another function, that's UB
@stdOrgnlDave it alloca'd in the function, it's a pointer to a local variable
 
@RMartinhoFernandes You sure that's UB? Isn't it implementation defined?
 
@Pubby nope, it's UB
 
9:23 PM
If it gets inlined then the memory may still exist
 
@Pubby Acessing memory that is not valid?
 
@Pubby optimizations do not make things no longer UB
 
Is alloca bound to the block or to the stack frame?
 
@Pubby That's one manifestation of UB. So what?
 
@RMartinhoFernandes Well it's not like alloca is standard :P
 
9:24 PM
@Pubby mkssoftware.com/docs/man3/alloca.3.asp "The alloca() function allocates space in the stack frame of the caller, and returns a pointer to the allocated block. This temporary space is automatically freed when the function from which alloca() is called returns."
 
So it is bound to the block
 
@Pubby I'd go with block
 
Parser generators hate me.
 
Do you guys think it would be sensible for std::string to have a templated constructor, template <typename N> string(const char (&literal)[N]), for a slight performance increase when constructing from literals? (It would know the size and not need to use strlen.)
Or does that break in some way?
 
@Pubby msdn.microsoft.com/en-us/library/wb1s57t5.aspx: _alloca allocates size bytes from the program stack. The allocated space is automatically freed when the calling function exits (not when the allocation merely passes out of scope).
@GManNickG seems good to me
The heck? "In Windows XP, if _alloca is called inside a try/catch block, you must call _resetstkoflw in the catch block." source
 
9:27 PM
haha
 
@MooingDuck That's strange, wonder why it's to the function but not to the block
 
@Pubby no idea
 
A true POSIX name. Almost no vowels.
 
:3531766 Right.
! Sneaky!
 
Sorry, thinking a bit.
(Too many parallel tasks right now...)
 
9:28 PM
Ha, that's okay.
 
@bamboon Wrong with what? The accepted answer?
 
@RMartinhoFernandes the answer I posted, just wanted to know whether there are some big mistakes
 
@bamboon Oh, I didn't notice that :) It seems okay, with the caveat in n.m.'s comment.
Nice to see that SFINAE style is catching on.
 
@RMartinhoFernandes ok, cool thanks
 
I figured out the inline part
> Note that certain usages in a function definition can make it unsuitable for inline substitution. Among these usages are: use of varargs, use of alloca...
 
9:34 PM
@Pubby good good
 
So that definitely is UB
 
Even if inlining was allowed, it was UB.
 
But VC seems to inline functions that have UB :S
 
Inlining is irrelevant.
 
So the memory could still be valid on VC
 
9:34 PM
rebooting
 
@Pubby But not valid in C++.
UB is a C++ thing, not VC.
 
I should write a test-case where I recurse all over the place to clear the stack, but, I'm too tired, cya
 
@Pubby just because you can access memory in a function doesn't make it valid or inlined
 
@RMartinhoFernandes Why not? What if alloca just returned malloc?
 
Just because it would have a certain outcome in VC doesn't change anything.
@Pubby malloc has different semantics.
The memory allocated by malloc is usable until a call to free with the pointer that was returned is made.
The memory allocated by alloca stops being usable once the function returns.
 
9:37 PM
Yeah
 
It's just like int* f() { int x[3]; return x; }.
The only difference is that the size is not constant.
 
Hmm, I guess VC has a bug then
 
It said it frees the memory but it doesn't :(
 
Freeing the memory doesn't mean zeroing it out or anything.
 
9:38 PM
But it says:
> The allocated space is automatically freed when the calling function exits
But inlining means it isn't freed
 
Thank goodness VS11 beta took away the italics for local variables
 
@stdOrgnlDave ideone.com/0uPhm
@Pubby How do you know that?
 
@RMartinhoFernandes It was in an answer here: stackoverflow.com/questions/1018853/…
 
Isn't the as-if rule applicable here?
 
Someone confirmed it for VC11
Hm, is it VC or VS or MSVC? I always forget.
 
9:41 PM
VC = MSVC
VS = Visual Studio which can be C#, etc
 
What compiler were you smoking? — trinithis Nov 16 '11 at 21:34
lol
My head hurts.
@Pubby Ow.
 
I'm sorry :(
 
@SethCarnegie I would think so, but MSDN explicitly says it is not freed until the function ends, despite block scopes
19 mins ago, by Mooing Duck
@Pubby http://msdn.microsoft.com/en-us/library/wb1s57t5.aspx: _alloca allocates size bytes from the program stack. The allocated space is automatically freed when the calling function exits (not when the allocation merely passes out of scope).
 
Solve your problem by not having blocks!
 
@MooingDuck are you sure it's inlined
 
9:46 PM
@SethCarnegie alloca prevents inlining
 
Then... what's the problem?
 
@SethCarnegie they're talking about hypothetical situations. If it didn't prevent inlining, it such and such UB anymore.
But the as-if virtual-machine rule makes it clear to me
 
void* ptr;
if(x == do_alloca_please) {
    ptr = alloca(n);
} else {
    ptr = malloc(n);
}
// ptr usable here
 
How the fuck did that answer get accepted with so many votes? My answer was complete from the start, he only edited it to 'sketchily' include an answer to the real question...:
1
A: Not getting the right values when copying structs

seheoffsets is supposedly an array of pointers, not structs. The memcopy will probably overwrite a large chunk of memory past the end of the memory allocated for offsets (allthough we can't see how much memory was allocated for it). I'd suggest: offset_p *offsets = (offset_p*)malloc(sizeof(offset_...

 
@sehe it happens
 
9:53 PM
Java is weird.
 
@SethCarnegie Yeah. I know. It was a classic case of someone posting a lame initial answer that gathered a 'noise-vote'. Then some people come by, see an answer with an upvote and support it blindly.
I hate it when that happens, because the answer was completely wrong until 24 minutes after I posted mine. I still feel my answer is much better than his even after his edit
 
Yep
FGITW FTW
 
Fancy, the TeXLive utility got a GUI overhaul :)
 
Anyways, I can stop now:
1 hour ago, by sehe
Let me see what I can repwhore
 
unfortunately, it’s now unusable …
 
9:56 PM
@SethCarnegie Yeah. But the fastest gun in the west used to include points for proper aim :)
 
times they are a changin'
 
@SethCarnegie Dat song's too gud ...
 
@SethCarnegie as always, I frantically repwhore (needed 65 rep to cap :)) and think 'ffs - why am I not getting any votes on my 4 answers.
Then, when finally I hit repcap (due to a spurious upvotes on an old questions), boats start rolling in :)
 
lol
I was really annoyed today on that "why does xoring this string produce weird results"
I took 30 extra seconds to verify that 'o' was indeed 111 before I answered
and some guy beat me to it
and then the answer got like 50 upvotes
 
@SethCarnegie Ouch
@SethCarnegie I always do the extra checks too. I tried yielding to time pressure, but I found that two things would start happening:
(a) people would start comment wars pointing out my omissions or silly mistakes
(b) I'd start making unnecessary errors precisely because of the perceived time pressure. That struck me as silly. I stopped sweating the timing.
 
10:02 PM
I try to not just answer speedily for the same reasons
 
That's probably why I like the spirit questions :) There's never any time pressure. Hah
 
it would have payed off today though :(
lol
my highest answer has something like 23 upvotes and it's that stupid "check if a number is even or odd without using any operators" question
 
a quick noob question: why can I use Obj obj = myFunction() where myFunction is declared as Obj& myFunction() yet Obj& obj = myFunction() fails where myFunction is declared as Obj myFunction
(note I'm tired ._.)
 
I think I can call myself lucky that my top answer is one that I actually put some effort in and it feels good to be rewarded for it.
 
10:05 PM
@user908041 because the return value would be a temporary and you can't create non-const references to temporaries
because they would die at the end of the expression
 
Many people seem to complain about getting many votes on the stupid ones.
 
@RMartinhoFernandes But I bet @SethCarnegie put effort in the odd even question! It's not as simple as it may look.
 
@RMartinhoFernandes it's annoying
 
@SethCarnegie Also, you might venture tha fmod is calling an operator (via a function/intrinsic; but nonetheless (all other operators get translated into the same assembly...)
 
ohh
 
10:07 PM
@sehe yeah but it's pointless to speculate about implementation details :)
 
Right @SethCarnegie, you can't create a reference to something that dies at the end of the expression... makes sense.
cheers
 
@user908041 if you change that to const Obj1, then the temporary's lifetime is prolonged until the reference goes out of scope
 
@SethCarnegie can't find the XOR Q/A you refer to, btw
 
@anybody does that have a name?
 
life time extension of temporaries
 
10:10 PM
@sehe I'll find it, sec
whoops
 
@SethCarnegie § 12.2 ad 5
 
14
Q: XORing "Hello World!" cuts off string

kutacz#include <stdio.h> #include <string.h> int main() { char greeting[]="\nHello World!\n"; int a; for(int i=0; i<strlen(greeting); i++) greeting[i]^=111; for(int i=0; i<strlen(greeting); i++) greeting[i]^=111; printf("%s\n",greeting); ...

grrr
 
watchadoing
 
that's the question
 
@SethCarnegie I don't want it to work, I just wanted to know why it didn't. Perhaps more importantly, I was wondering why the former did work. In fact - how does the former work? In that Obj obj = myFunction(); will compile yet obj won't actually be a reference, despite the function being declared that way.
 
10:12 PM
@user908041 that creates an object that is initialised with the return value of myFunction, which is a reference
 
@user908041 Of course it won't be a reference. You declared it as an Obj so it's an Obj.
 
So it calls Obj(Obj&)
 
@DeadMG yes I know that
 
@SethCarnegie oh that's painful indeed. especially since the cause is so immediately obvious. It just takes time to write it and locate the specific boundary value 'o'.
 
Right @SethCarnegie, but without it being Obj& obj, it just remains as the value it was when it was assigned?
 
10:13 PM
@sehe one upvote is mine though, the answer is correct
 
so the var is the value of the reference, not the reference itself? ._.
 
@user908041 yes, the reference refers to the static variable inside myFunction
if we're talking about that code you wrote earlier
or whatever you return a reference to
 
If I do static int x; in a header does that mean a different x will exist in each TA that includes the header?
 
@user908041 from § 12.2 ad 5
> A temporary bound to a reference parameter in a function call (5.2.2) persists until the completion of the full-expression containing the call.
 
10:14 PM
Says a lot about SU vs. SO culture too right there
 
@user908041 so in short, the Obj& in the return type keeps the object inside the function from being copied in the return, and the Obj& in the variable declaration keeps a new object from being copy-constructed from the return value of the function
 
yes, it does
 
@KonradRudolph Congratz by the way
 
@KonradRudolph wow that was fast
 
10:15 PM
got it, thanks @SethCarnegie
 
@KonradRudolph you beat mine by 3 votes :)
 
Basically, I think it means that the SU crowd don't know what twitter, reddit, slashdot, y-combinator, HN etc. are :)
 
I couldn’t even brag to my colleagues about it – the guy next to me in office wrote something on Twitter today that was retweeted more than 100 times, and ended up in the nationwide news in France
 
There are no stupid questions. No, there maybe are -- but I think this one's actually very interesting. Featured as a question of the week candidate. — slhck Jun 8 '11 at 20:01
 
10:17 PM
which is a very good question, by the way
 
@KonradRudolph And was subsequently fired for twittering during office hours :)
 
@sehe Nope. Not us.
 
Joking :)
@KonradRudolph Link?
 
2
Q: Encapsulating Data Outside of a Class

Christopher BermanI'm writing some C++ functions that will produce data that may or may not be processed later by those functions (but will not be processed anywhere else). These functions are the 'low-level' for some higher-level, GUI changes. I'm currently wrapping these functions in a separate namespace, and h...

"I made a global, does it avoid pitfalls of global?"
 
10:19 PM
#Trocadero : 200.000 personnes ! On se fout de qui ? Petite image explicative en voyant ULTRA LARGE sur la foule http://t.co/lktXLK8w
context: French presidential candidates, there was a congregation with claimed 200.000 participants
my colleague did a rough calculation based on the surface of the gathering place
summary: 200.000 is a shame-faced lie, off by roughly an order of magnitude
 
Haha that's pretty clever
 
now ever supporter of Sarcozy is pretty mad at him
 
Silly French.
 
Politicians lie? IMPOSSIBRU.
 
No wonder
he said 200.000
not 200,000
so I think 200 people is pretty reasonable
 
10:21 PM
Sarko is quite the asshole, from what I've heard.
 
@SethCarnegie French locale
 
Yeah, kidding :)
I didn't know you could unstar things
 
Yeah, don't do that.
 
@SethCarnegie Like editing questions.
@CatPlusPlus I was revoking my star temporarily to see what had fallen off the starboard :)
 
@CatPlusPlus wasn't me
 
10:24 PM
@SethCarnegie Ooops, he’s using the French system – as was I, accidentally. 200000 is the alleged number.
 
@KonradRudolph If that was the only thing the politicians lied about, our world would be actually a wonderful place to live in ...
 
Either tomatoes are rather hard to cut or my knife needs sharpening rather badly.
Though it cuts onions fine. It is a mystery. :.
 
Tomatoes are hard to cut because they are soft and onions vice versa
 
Onions are easy to cut because you pay for it with tears.
 
I mean it takes a few cuts to get through skin, not that it becomes squishy mess when you try to cut it.
That's a different matter.
 
10:28 PM
@RMartinhoFernandes Tomatoes are best not cut by robots because they will pay for it with a limb
Oct 31 '11 at 14:09, by R. Martinho Fernandes
It's not just knowing how to cut them. I really can't hold a knife steady. It's a matter of safety.
 
@RMartinhoFernandes At least you know it's fresh. :.
 
What determines what tag appears in the title of a page when you look at a question
 
Most popular.
 
@sehe Oh, don't worry, I strive to avoid it as much as possible.
@SethCarnegie Popularity.
 
@CatPlusPlus no, can't be
0
A: does Lua allow metamethods with weird number of arguments?

Seth CarnegieNo, the index operator can only take one argument, as in C++. While the function for the index operator can have as many arguments as you want, if you actually try to use more than one inside the [] you'll get an error. It depends on the operator. So you neither can nor need to "enforce" that.

Tag in the title is "operators"
but it only has 1,xxx questions and "lua" has 2,xxx
 
10:30 PM
operators are far more useful and exciting than any three letter acronym. Except MOD
 
Maybe was added in ninja edit.
And cache kicked in.
 
could be
 
Maybe it's based on views/total posts, not question number?
 
and oops, meant to link to the question not the answer
 
@sehe lua is not a TLA.
 
10:31 PM
So my hunch wasn't too bad: i thought it was the first of the tags really
 
It's Portuguese for "moon".
 
It used to be :)
a TLA that is
 
@RMartinhoFernandes Damn I need to go to bed
@SethCarnegie I thought you meant the moon
 
@SethCarnegie No, it was named to be Portuguese for "moon". It wasn't a TLA.
 
10:32 PM
Its author is Brazilian.
 
@RMartinhoFernandes no, originally it stood for "Linguagem Para Usarios de Applicao"
 
Not many people know that
 
This is the only reference I can find takhteyev.org/dissertation/chapter_3_2
 
@SethCarnegie lua.org/about.html ""Lua" (pronounced LOO-ah) means "Moon" in Portuguese. As such, it is neither an acronym nor an abbreviation, but a noun."
 
10:34 PM
@MooingDuck that refers to now, not before
1 sec
 
Well, that is the official website.
 
From the lua 1.0 source code
/*
** lua.c
** Linguagem para Usuarios de Aplicacao
** TeCGraf - PUC-Rio
** 28 Apr 93
*/
 
> None of the people he knew personally had heard of Lua before. Craig cites Lua’s small size and simplicity as the reasons for choosing it over a “more mature” language such as Python. He was particular concerned with security of his application and felt that “a sort of more mature language like Python” was too complex for him to be sure that his application would be safe from malicious hackers.
Wat.
 
@sehe Yeah saw that, that is cool
now we don't have to learn java
 
10:36 PM
You didn't have to before.
 
> What if we could swap out Java with faster C# and get rid of various Dalvik limitations in the process?
 
@SethCarnegie takhteyev.org/dissertation/chapter_3_2 "In mid 1993 Roberto, Waldemar and Luiz Henrique met to discuss the possibility of replacing both DEL and SOL with a new language, which was soon implemented by Waldemar as a course project. They called the language “LUA,” meaning “moon” in Portuguese. This was as a pun on “SOL” (Portuguese for “sun”), but also, as somewhat of a joke, an abbreviation for Portuguese “Linguagem para Usuarios de Aplicação” — “Language for Application Users.” "
 
Mono for Android was released in 2011.
 
I want C++ for Android
 
@RMartinhoFernandes I know. This is far far more ambitious. This is about getting rid of Dalvik alltogether
 
10:37 PM
Whinedroid.
 
@Pubby It's called NDK
@CatPlusPlus ?!@#!@#!@#K RAGE
> We decided it was crazy enough to try. So we started a small skunkworks project with the goal of doing a machine translation of Android from Java to C#. We called this project XobotOS
 
@sehe I thought you weren't supposed to use NDK for full applications
 
@sehe So? You didn't have to learn Java to target Dalvik.
 
@Pubby You're not supposed to speed on the highway
 
There are many VMs for Android, AFAIK.
 
10:38 PM
You can target Dalvik with C# since last April.
 
Java is hardly the only choice.
 
@RMartinhoFernandes True. But that comment seemed to downplay the importance of that article. Which is why I stress that there is more going on here
 
> Our goal as a company is to provide the best platform for building mobile apps, and so XobotOS will not be a focus for us going forward.
Also this.
 
@KonradRudolph lol
 
@sehe I know. I linked to that article an hour ago.
1 hour ago, by R. Martinho Fernandes
Android rewritten in C#, to avoid those pesky lawsuits. http://blog.xamarin.com/2012/05/01/android-in-c-sharp/
 
10:40 PM
@RMartinhoFernandes I don't tweet. Also, of course a robot will notice and spread links faster. I was just raving.
 
@MooingDuck Meh, I trust the source :)
 
HI HOW ARE YOU)
 
Your Shift keys are broken.
 
Morituri Dormituri vos salutant
 
Yay, I know what that means!
 
10:42 PM
@SethCarnegie That page was teh only hit on google for lua "Linguagem para Usuarios de Aplicacao" If that didn't convince you, I'm out of ammo, so I'm going back to work :P
 
@MooingDuck well it would take away my feeling of superiority so
I'm gonna stick with it :)
 
mawnin nubberies
 
@RMartinhoFernandes It means that your 'r' key is failing intermittently?
MAWNIN NUBBERIES)
ftfy
 
What is a nubbery, and why do they mawn?
 
why the caps?
 
10:44 PM
SCROLL UP)
 
@RMartinhoFernandes What class are you talking about? "if you want it to be in the class, you have to declare it in the class. It doesn't lead to any linker errors: only definitions do."
 
@Pubby OMG, I need sleep.
11
Q: I'm a really bad programmer - what should I do?

Richard1987You know when you read blogs like Joel on Software or Jeff Atwood? Well, I'm one of the people they talk about when they say programmers who don't love what they do should leave the industry. I guess I'm going to have a hard time finding people who feel the same way on a programming forum, but ma...

 

« first day (563 days earlier)      last day (4390 days later) »