« first day (532 days earlier)      last day (4401 days later) » 

12:01 AM
@Mysticial void* operator new (std::size_t size, void* ptr) throw();. Takes void* assumed to be aligned, bypassing the problem.
then again, it returns void* as well, I dunno how the rules apply here
 
alignment is super-tricky in a large HPC program
if you don't design for it from the start, it can easily screw you over..
*with vectorization
 
@Mysticial Pointers to char types are allowed to alias.
And in any case aliasing restrictions doesn't mean you can't cast at all. It means you can't access the same memory with two lvalues of unrelated types at the same site or something like that. (Paraphrasing very liberally here.)
 
@LucDanton That can't always be true, because this example I posted will crash on a machine that doesn't support misalignment:
unsigned char buffer[5];
int val = *(int*)&(buffer + 1);
 
@LucDanton is 10k now? Dunno if I should congratulate or feel sorry for!
 
Here you're aliasing an int* with buffer + 1. So it has to be undefined behavior since it will crash without misalignment support.
 
12:06 AM
is there a way of creating a structured array without knowing the size, so it don't get destroyed in a for loop?
 
Oh wow @LucDanton congrats on 10k!. Enjoy the mod tools.
 
@LearningC What?
 
@Pubby my structured arrays are getting destroyed after the a for loop. How can I save it so I can pass it to other functions. I have to create structures dynamically.
 
What's a 'structured array'? Just use malloc
 
user457812
Didn't we already explain that?
 
12:08 AM
@Mysticial Alignment issues are separate from aliasing issues. Just because you're allowed to alias doesn't mean the alignment is correct.
 
@nil yes but I'm still confused.
 
user457812
About what?
 
@LucDanton hmm, the way I read that strict-aliasing rule is that you're allowed to alias any datatype with char*. But not the other way around...
 
@nil do I callock it while in the loop or after?
 
user457812
You allocate when you need to allocate..
 
user457812
12:11 AM
I don't really see what you're confused about there.
 
 struct track* all_tracks = malloc(num_tracks * sizeof(struct track));
 for(int i=0; i<num_tracks; ++i) {
       //stuff
 }
 return all_tracks;
 
@MooingDuck so this will return an array right?
 
No, it returns a pointer
 
@Pubby so my function must be a pointer aswell?
 
???
 
user457812
12:16 AM
O_o
 
Why do you want to return the pointer/array in the first place?
 
@Mysticial That might not be wrong. This is the limit of my knowledge regarding aliasing btw, some of the details still baffle me (Johannes once showed me code that I didn't expect to be valid). Be that as it may, treat aliasing as separate to alignment.
 
I need to pass it to another function
 
user457812
I will excuse myself from helping @LearningC because my brain hurts
 
@LearningC But why? Can't you call that function from inside the other one?
 
12:17 AM
@LearningC that bit of code returns a pointer to an array. You can effectively pretend it is an array, but it's not technically an array.
 
user457812
I'll just quietly sit over here reading and wondering when my PlayBook thingy will arrive
 
@LucDanton Ah ok. There's also another corner case with casting a pointer to a struct to a pointer to the first member of the struct. The question is, whether this is allowed if the struct is not polymorphic.
 
@nil Playbook. Right.
 
Anyways, I need food. bbl
 
@Mysticial Yes, although the exact condition is likely to be 'if the struct has standard layout' rather than polymorphism.
 
user457812
12:19 AM
@MooingDuck What? O_o
 
@LucDanton Ah! That's good to know. thx :)
 
@nil Nevermind, I was channelling the lion for a moment.
 
user457812
I both get and don't get that.
 
user457812
At any rate, I got free hardware, so I'm stoked.
 
Javascript is as fast as C++? h-online.com/open/news/item/…
 
12:24 AM
@Pubby ...no. "According to the company's own benchmarks..."
 
user457812
I calls bullshit
 
@Mysticial Yow, it might be the case that the member also has to be an aggregate or something.
 
@Pubby their multithreaded C++ is 7.73 times faster than their singlethreaded. That sort of speedup either means (A) Their C++ isn't a fair comparison, or (B) Their test is contrived.
for instance: not taking advantage of the full functionality of Javascript
 
What's wrong with 7.7 speedup? What if they had 20 cores?
 
12:27 AM
@Pubby no computer has 20 cores. 8 yes. 16 dubious, 32 dubious. 20 no.
@Pubby I'd assume 8 core, but even with 8 cores, that's really close to an 8x speedup, which doesn't happen in the real world.
 
I bet there's one with 20 - I've seen 3 and 12, they don't have to be powers of two.
 
I found one of those examples (or claims, if you're skeptical) that baffle me from Johannes:
Jul 29 '11 at 15:07, by Johannes Schaub - litb
if float and int are same aligned and sized on a particular platform, you can say float a; int *p = (int*)&a; *p = 10; cout << *p; in the current spec and it will work without UB. But if you later access a, you do an aliasing violation
 
@Pubby I've seen squares before, but not 3. If you say you've seen it, maybe you have, but I still doubt they can make Javascript as fast as C++
@LucDanton that's pretty bizzare, I'd want to look up the (int*)&a in the spec.
 
@MooingDuck Oh, and their code doesn't seem to have any sharing, so 7.7 is very possible. But yeah, their claim is likely bullshit or irrelevant in practice
Hmm, actually it seems that it's not JS that is as fast as C++, but low-level code FFI'd into JS that is as fast as C++
 
@MooingDuck It's doubly complicated in that the aliasing rules are specified regardless of what conversions are allowed. So sometimes the challenge is not finding a way to skirt around the aliasing rules, it's finding a way to obtain the pointer you want to skirt around the aliasing rules. Sheer madness.
You can pick random elements from std::set with std::next(s.begin(), r) where 0 <= r < s.size(). Not constant time obviously though.
 
12:37 AM
"iterating through a std::set random number of times...how slow would that be typically?"
 
Removing should be logarithmic, you don't have to compare anything yourself, that's one of the point of std::set.
Yes.
 
1:24 AM
hallo
 
@MooingDuck Um... no, there are a few quad-socket servers that run up to 32 cores, 64 hyperthreaded
My department has one that I can play with.
 
1:54 AM
@MooingDuck Yes I am obeying physics for now...
 
oh goodie, I think I have an integer overflow bug...
somewhere buried in about 50k lines of code...
it works in x64, but not in x86
the only difference is the size of the pointer...
 
@Mysticial time for that ctrl+F key code
 
2:10 AM
It's almost always a missing cast. When I do something like:
 
@Mysticial Looks like a needle and haystack problem.
 
(64-bit file pointer) = (size_t object) * (size_t object)
It's happened to me many times before.
both the x86 and x64 versions work
 
toggle function?
 
but once I scale the x86 version to sizes that need more than 20GB of disk, some things break until I find all the missing casts
So I'm not particularly concerned
Yes it's a needle in a haystack, but I've got a fucking magnet and torch.
7
 
Can you catch integer overflow errors with the debugger or valgrind?
 
2:14 AM
@StackedCrooked That'd be a bad idea... because I abuse it in a number of subroutines.
 
Also a bad idea is that the repro time is on the order of 2 hours... attaching a debugger and getting useful data out of means turning off optimizations and disabling multi-threading
 
sup
 
@CatPlusPlus hai
 
so I've had to learn the art of debugging with full optimization...
 
zzzz
 
I think I'm going to be posting my game soon for playing + looking at source code :o
 
@Mysticial So you have built-in checking mechanisms?
 
@StackedCrooked Yes, but they didn't catch it in this case. So I need to do the good old "guess where it is" thing. I'll be adding print statements in key parts of the program to see where it might overflow.
 
Wow: https://www.google.com/search?sourceid=chrome&ie=UTF-8&q=sqrt(x*x%2By*y)%2B3*cos(sqrt(x*x%2By*y))%2B5
Lol, url doesn't work.
 
user406009
2:26 AM
WTF? Is that the Webgl stuff people keep on talking about?
 
I wonder if attempting to remake what I have of the game in python to C++ would be a good learning experience... or a potential hazard to my health...
 
hey
all my servers are down so i thought i spend some time here xD
 
@joschua011 everyone is a bit sluggish now, not sure why :P
busy most likely
 
i just called my hoster...which was pretty funny actually xD
i said "hello.. i have 3 servers in Zurich" and he "yeah... i know"
 
2:32 AM
lol
@ScottW welcome back to the living?
 
looks like the enitre network is down
 
(lol <- is a disease and shouldn't be used.) welcome back to teh interwebz?
if you want to see nightmares, look up python one-liners :D
or that :)
for some odd reason I can never accomplish coding more than 600 lines of code in any program I make... ???
coding code.. now isn't that a theory -.-
... genius :o
although I do usually split my programs up into 3-4 files each though, I guess its just a java thing :P
speaking of which (not really...) I needs to format my USB :s brb
 
In C when it returns a pointer, it will return a address right?
 
user406009
Yeah.
 
user406009
Although doing most of anything directly(other than dereferencing) with an address is UB in C++.
 
2:44 AM
what if the function is a pointer. How should I read it? *x=function();?
 
user406009
Are you looking for a pointer to function, or does function return a pointer?
 
a function returns a pointer
 
If it returns a pointer then it isn't a pointer
 
int *x
 
rofl... I think I need to work on my "use" function, wearing a candle isn't exactly right... is it
 
user406009
2:48 AM
Then yes, the function is returning a pointer, aka an address
 
when int *function() returns an address and x is an pointer....wouldnt be x = function() correct?
 
^ what he asked.
 
so... *x = function() or x = function() ?
 
user406009
Really depends on the types involved. A better example would be one that could compile.
 
user406009
C++ has too many ambiguities for a single statement to have much meaning.
 
2:57 AM
Stop using the term 'address'
 
Address.
3
 
:)
 
user406009
Yeah, knowing the C++ standard it could just be a series of prime numbers with no relation at all to memory.
 
I'm not trying to go by the standard, it's just that 'address' isn't a type. It's like saying "this function returns a hash can I store it in an int"?
 
long repro times suck... I managed to get it down to 20 min... but still...
HA! I found the missing cast!
even before I finish repro-ing the problem a second time.
 
3:51 AM
D's template mechanics are even weirder than C++'s!
 
> oh, I was using [pointers] cuz our teacher said we had to learn how to use them in pretty much everything we do. K, so no pointers needed. Thanks!
 
@Pubby One cannot "know" C++ without "knowing" pointers. It lets you appreciate things like iterators. That said, you shouldn't have to actually use them.
 
4:06 AM
@Maxpm I'm all for using pointers, I think they're extremely important to learn early on, I just think it's idiotic for a teacher to say to use them in everything.
 
@Pubby Yep.
 
Look at the code that advice produces: stackoverflow.com/questions/9952849/…
 
Oh dear.
 
can i get someone to help me identify a pattern?
 
@WhatsInAName Probably.
 
4:13 AM
Without the snark
 
Okay. ;P
 
@WhatsInAName You can start by talking about this pattern you want to identify
 
The c=1 cases are easy to identify
but I am trying to figure out how to use that information to derive c=2 and c=3 etc
for a given n
 
How about you copy and paste the text instead of pictures?
 
because it won't be prettily formatted
 
4:15 AM
You never heard of ASCII tables?
+---------+----------+---------+
| First   | Second   | Third   |
+---------+----------+---------+
| First   | Second   | Third   |
+---------+----------+---------+
| First   | Second   | Third   |
+---------+----------+---------+
 
it's much more difficult to convert excel to equal-spaced ascii than it is to click a picture
 
It's much more difficult for me to copy and paste a picture so I can do something useful with the numbers in the picture than copy and pasting and ascii table into excel for me to work with
 
blah, forget it
no easy way to do it
 
Well, I have no clue.
 
@WhatsInAName Let me help you
n=2, c=1: 1
n=3, c=1: 2, 2
n=4, c=1: 3, 4, 2
n=5, c=1: 4, 6, 4, 2
n=6, c=1: 5, 8, 6, 4, 2
n=7, c=1: 6, 10, 8, 6, 4, 2
n=8, c=1: 7, 12, 10, 8, 6, 4, 2
And so on.
 
 
2 hours later…
6:39 AM
damn, didn't work.
 
7:05 AM
morning
 
Good afternoon.
 
7:34 AM
Why would GCC need libGMP to compile?
I haven't searched the code, but I can't imagine why it would need to know
 
@Daniel GCC uses GMP for constant folding.
 
righto
cheers
if the target platform doesn't support 32bits etc
does it also use it for that?
 
8:06 AM
GMP supports both 32-bit and 64-bit. I don't see how that would be a problem.
 
Do you know simple, lightweight XML writing library? (I want to log graphs of objects from my program in xml). I dont need parser.
 
8:35 AM
mornin'
If you are new here, please read the newbie hints. Thank you.
20
^^ can someone please star that, the last one dropped off
 
why does in C++ 11 exist Tuple type?

If any simple Aggregate already was a Tuple?
 
@user1131997 because it means there's an easy and canonical way of having an aggregate of 3+ things, that doesn't require your api users to remember what you called it
(among other things)
@KerrekSB ta for pinning it, i assume that was you
 
8:51 AM
@je4d No, me.
 
@DeadMG ooi.. do you have to be a room owner to do that, or is it a rep level?
 
sup
 
@je4d Room owner.
 
9:22 AM
@Mysticial That's fucking brilliant :)
 
I have a nasty headache
and for once, paracetamol, it makes no difference
:(
 
If either of you guys have a moment can I get a little help haha
 
@vorbis5 If you've posted on SO, paste the link and i'll have a look..
 
sweet
2
Q: Circular collision rebound not working properly

vorbis5I'm writing a little physics simulation in C++ that basically moves circles across the screen and when two circles collide, they should ricochet in the same manner as billiard balls would. When the circles do collide with each other, most of the time they will practically slow down infinitely/the...

 
@DeadMG Paracetamol saves me from going insane about once or twice a year.
@DeadMG Theres is harder stuff in case Paracetamol has no effect, but you usually have to take those on a full stomach, and it takes more time to kick in.
 
9:37 AM
Ooh, I have a headache, too. Let's make a headache club.
But then again I'm probably still drunk.
Perfect time to play DF.
 
@vorbis5 I put in an answer that covers one problem with it, but i've not analysed the trig so I've no idea whether there's more or not :)
 
@je4d :) lemme check it out
 
 
1 hour later…
10:46 AM
@vorbis5 if (b[i].BallCollision(b[j]) == true) huh? BallCollision is declared void.
does it compile with -Wall -Werror?
 
10:56 AM
Hello people!
 
hello
 
Ell
hi :)
you know I still dont understand why the constness of something cant be inferred
 
what do you mean?
 
I have a n0000b problem with the notebook keyboard....
How I can write the tilde character (the one that is used as prefix of a C++ destructor) on a keyboard without numpad?
 
totally depends on the localization of the keyboard?
 
11:02 AM
IT
 
well, sorry, I don't magically divine that keyboard layout
use Google?
 
And the notebook is a HP Presario CQ62-220SL
 
Numpad for tilde?
 
@CatPlusPlus i was wondering that, i've never seen a numpad with a tilde on
 
right
an idea: I've had one
 
11:05 AM
I'm trying.. But I just discover to use ALT+FN+ the FNnumpad (that should be on the other buttons, like jko..) but my keyboard doesn't has this buttons...
 
> the tilde (~) character is not present on the Italian keyboard layout
Lol.
 
Yeah, I know xD
But you can write it using ALT+126 (from the numpad)
 
Buy a better keyboard.
 
~
just copy and paste it, like we have to do with # and Macs in our labs at university
 
@CatPlusPlus .....On the notebook? ....
 
11:07 AM
Or modify the software layout.
You know there are USB keyboards you can just plug in, right?
 
@DeadMG It's a bit awkward to copy and paste each time you have to write a destructor name...
 
If you use Windows, you can create a keyboard layout using MSKLC. On Linux, it's somewhere in X settings AFAIR.
 
@CatPlusPlus Modify the software layout it's an idea (buying an USB keybord not...).
MSKLC? Where is it?
 
Why not? Notebook keyboards suck for anything, anyway.
Especially the narrow ones with no numpad.
 
@CatPlusPlus: I know, but this is enough comfortable. An USB keyboard doesn't fit in the notebook bag xD
 
11:11 AM
@unNaturhal We KILL People Who KILL People Because KILLING People Is Wrong... But if you kill people who kill people, won't other people kill you?
confusing.
 
@IntermediateHacker LOOOOOOL
Imagine this sentence sayed by a soldier of an any peace mission...
 
As for MSKLC, if only there was a website where you can put names in and get URLs back.
 
I dunno man
that sounds like some hyper-advanced futuristic shit
 
One thing I hate about hyper-advanced futurisitic shit is, you never know when it stops being futuristic. :(
 
in this case, about 1996
 
11:17 AM
 
guess there's still market for those 2D strategy games after all.
> First, and foremost, Real Programmers are about the testosterone. If your average Cobol/Java drone thinks programming should be (needlessly) dull and boring, your average Real Programmer thinks programming should be (needlessly) difficult and dangerous. The purpose of programming, to the Real Programmer, is to prove how clever and/or manly they are.
I think C fan-boys are the only Real Programmers left. Or am I wrong?
 
@IntermediateHacker Who wants C? Real Programmers use assembly or Verilog.
Or just draw the schematic with no help from a computer at all.
 
@Potatoswatter REAL Programmers use hex.
or handle the circuits directly.
 
There was a really old dude at my previous job who actually did that. He implemented OR gates from BJT transistors where the microcontroller should have been doing the job.
 
that's scary. O_O
 
11:23 AM
Then I had to work backwards and figure out the correct inputs from the MCU to the OR gate :D good times…
 
@IntermediateHacker For a certain pointless definition of "real programmer"
 
Also for a certain definition of danger. I think C++ TMP is very dangerous in an only slightly different sense.
 
anyone has AAA implementation experience?
 
A game where you can punch people with doors? I want it now.
Why is there no preorder alpha thingy WHY.
 
11:40 AM
@Potatoswatter & @IntermediateHacker xkcd.com/378
 
Real programmers use the right tool for the job.
5
 
@CatPlusPlus Just noticed that? it's awesum
 
Yeah, via RPS.
 
11:56 AM
hmm
I think that instead, I should have like, HumanPlayer : Player, AIPlayer : Player, RemotePlayer : Player, for example
that would be a cleverer solution to my problemo
damn, I finally found out why my line-rendering code won't work, such a silly error :(
 
There's something terribly cool about playing DF Adventure mode as bronze colossus and talking to people like nothing happened.
 
12:12 PM
@DeadMG plz tell us
 
"Don't travel at night, or the bogeyman will get you."
 
forgot to set shader to the device again
 
@DeadMG eek, inheritance
 
@FredOverflow Yeah, decided against that afterwards
 
Toying with the idea of buying a new monitor, but I can't decide between TN, VA and IPS :(
On another topic, will Ivy Bridge have better graphics than Sandy Bridge? Not that it really matters, just curious.
 
12:15 PM
no idea, but I'd expect so
 
@FredOverflow yeah, about 50% boost
 
on-CPU graphics is something where Intel are pretty desperate to finally become competitive with nVidia
and ATi
 
@bamboon not very impressive for low end
@DeadMG nvidia and ati have onboard cpu? on amd chips, I suppose?
 
Intel fails at GPUs.
 
12:17 PM
@FredOverflow No, AMD ships on-board GPU
but I meant, price/performance competitive with discrete GPUs
 
@DeadMG Oh, so AMD processors don't have graphics, but the mainboards do? interesting.
 
I mean, conceptually, it should be doable, since it'll be much faster between on-chip GPU and CPU to transfer data
 
right
lol, the myth busters are also serious hardware testers? :)
Although I haven't read the article yet... maybe they just blow stuff up.
Release of Ubuntu 12.04: April 26
Release of Ivy Bridge: April 29
It's pretty unlikely Ivy Bridge will run without problems on Ubuntu 12.04, right? Or is there not so much difference to Sandy Bridge? That had stability problems on Ubuntu for at least one major release I think.
 
Does anybody here know if clang preserves comments in the AST? I want to write a documentation tool and use clang for parsing.
 
12:32 PM
@FredOverflow I doubt that there will be big problems, I think it is more a kernel question. however no guarantee
 
@daknok_t Unlikely.
 
Where would comments go in the AST?
 
@Potatoswatter good question. :P
 
Just use an ADT (abstract documentation tree) ;-)
@Potatoswatter Where do Java annotations go in the abstract syntax tree? Maybe comments could be handled in a similar way.
 
You might write your own parser to just get the comments and doc markup, then cross-reference the positions of the comments to token positions of declarations in the AST.
 
12:35 PM
libclang does syntax highlighting, so it does know about comments. I'm not sure if it's easy to combine that with things like classes and functions, though.
@Potatoswatter Wish me luck with parsing C++.
 
@daknok_t I wish you luck with parsing C++.
 
@FredOverflow Thank you.
 
You'll need it ;-)
 
@daknok_t Lol, use Clang for that part ;)
Easy to write a parser just to get comments. You could use my preprocessing library if you want, it has a mode to preserve comments as tokens.
 
I could also just fork clang, of course. Luckily the diffs are available.
 
12:40 PM
Well… it might have been even harder to get comments from some scattershot AST node than to get the file positions of nodes you care about, and sort them relative to comments you easily found yourself.
 
I might indeed be better of with finding the comments without clang, and than using clang find out the first declaration or definition that follows the comment. clang does preserve columns and rows.
(columns and rows = physical source location)
 
man
how can I get an exception when I haven't even executed main yet? :(
of course, running in debug mode might help in isolating he poblem
 
12:57 PM
Constructor of a static object?
 
in VC++ everything can throw
 
nope, just the call stack isn't worth much when you're checking it in Release mode :P
aaaaargh
I broke my projection matrix again :(
 
It should be fairly accurate, if you're not compiling without frame pointers.
 
what is it with D3D projection matrices that breaks them at the drop of a hat
I didn't even change any of that code :(
 
1:20 PM
I'm now a dragon that doesn't fly, but is very good at swimming.
Makes perfect sense.
 
lol
in what game?
 
Dwarf Fortress, adventure mode!
I can breathe fire. This is going to be awesome.
"The Stray Cat head-bumps the Stray Dog."
 
lol
 
@CatPlusPlus Does this portend an epic batturu?
 
hmmm
1. Object renders. 2. Change camera position- object disappears. 3. Change camera position back to the original- object does not reappear
fuck
 
1:28 PM
My dragon is in desperate need of hands.
 
Meh, the game didn't register dragonfire kills.
I'm disappoint.
 
@DeadMG don't you have to rerender after you change camera position?
 
@TonyTheLion I render all the time
 
donno then
 
1:43 PM
You see so many different perspectives on SO. This guy seems only marginally aware that C is a language outside Win32:
1
Q: How do you define a constant in winapi?

Andrei Cristian ProdanI'm trying to build a switch and I get an "expression must have integral or enum type". I'm guessing the switch in winapi doesn't take variables with LPSTR type? char testbuf[ 51 ]; // allocate space for 50 characters + termination LPSTR test = testbuf; scanf("%50s", test); // read at most 50 ch...

 
lol
 

« first day (532 days earlier)      last day (4401 days later) »