« first day (565 days earlier)      last day (4385 days later) » 

7:03 PM
There's a C95?
 
@RMartinhoFernandes Nope.
 
@RMartinhoFernandes The term C94 (or C95) is sometimes used to refer to C89/C90 plus Normative Addendum (aka Amendment) 1, whose primary addition was support for international character sets. This amendment was integrated into the later C99 version of the Standard, so it is necessary as a separate document only for C89/C90.
That's what this webpage says.
 
Ok.
I propose the next Reader Q&A to be titled: “What about VC11 and XP?”

(Just kidding. Hopefully an official response will be made in a few weeks as stated by Steve Teixeira.)
hehe.
 
@Robᵩ /dev/tty? I know what TTY is, but I didn't know that was in linux. Does it have /dev/tts too?
 
7:07 PM
@MooingDuck TTY is short for "TeleTYpe".
/dev/tty the terminal device.
Or something like that.
Oh, you didn' say "don't" between "I" and "know".
 
@RMartinhoFernandes right :D
 
Fuck, I've been constantly distracted this week.
 
I was trying to figure out how to point that out politely
 
Next time I am acting stupid, you have my permission to skip the politeness.
 
guys I need your help plz..
 
7:11 PM
I am having the most frustrating time trying to figure out why this is striding 2 pointers at a time instead of 1 when doing dereferencing
 
"striding" 2 pointers?
 
oops
I have ptr_t wrong, I can't remember what the correct type is
 
Why would you expect the difference to be 8?
 
because that's what the difference is when the array is populated
and it's targeted at 64 bits, which means 8-byte pointers
and ptr_t is defined as unsigned long long
it arrives at the correct dereference, I just have to feed it (correct number)/2
so say, I have 1000 pointers, I have to tell that 500
 
Ah, I thought ptr_t was a pointer type.
 
7:23 PM
I changed ptr_t to be intptr_t, still the same problem
 
It seems correct to me. I'd double check the source data.
 
I triple-checked it, but I'll do it again
 
sbi
I wonder what business they expect me to be in...
 
@RMartinhoFernandes codepad.org/4U9C7Ard
there are no blargh's
 
7:29 PM
I'm awesome.
 
each pointer points 8 bytes before it
yet when passed to that function, they seem to point 16 before them
 
Damn, I should've known that would be star bait.
 
magic numbers!
(removed)
 
seriously where's my gap in logic?
 
@stdOrgnlDave why ptr_t what instead of ptr_t* what?
 
7:32 PM
@stdOrgnlDave it doesn't work because it's bad code.
 
All my stars! They're gone!
 
UNSTAR ALL THE STARS
 
sbi
@RMartinhoFernandes Stop doing that and behave like a room owner should.
 
@sbi Doing what?
I'm the victim.
 
It's not bad code. You can't use a void * to point to a void *, or an int * to point to an int *
you need an int ** to point to an int *
 
sbi
7:33 PM
@RMartinhoFernandes Oh. I thought you were starring like a madman. Sorry.
 
void *dereference(ptr_t what, int num)
ptr_t our_ptr = what;
ptr_t *ptr = (ptr_t *)what;
our_ptr = *ptr;
ptr = (ptr_t *)our_ptr;
that's bad code
 
instead, just store the pointer addresses as the built-in integral pointer representation
@MooingDuck fix it?
 
@stdOrgnlDave why are you trying to do that?
 
dereference 2 gigs of pointers
 
7:34 PM
@stdOrgnlDave I can't tell what the intent is
 
@MooingDuck it is in function dereference...it takes an intptr_t...with an argument 'num'...I would think it's obvious it's to dereference that ptr num times
 
@stdOrgnlDave wait, you have pointers to pointers to pointers for 2GB worth, and only one actual piece of data?
 
@MooingDuck it's cool these days, didn't know?
 
@stdOrgnlDave there is no good reason for such a function to exist in C++.
 
7:36 PM
oh and by the way can I see the most recent version with comments of your quicksort?
 
@MooingDuck I'd love to see your face right now.
 
@bamboon I need to rewrite it, I thought of a faster way
 
@MooingDuck it doesn't matter if there's a good reason, it matters that it is unintuitively broken
 
dereference(ptr_t what, int num)
{
      while (num --> 0)
           what = *(ptr_t*)what;
     return what;
}
 
Hehe, bonus points for "goes to".
 
7:38 PM
tried that, I think. I'll retry it
 
@stdOrgnlDave why do you expect diff to be 8? Are they in a pointer array?
 
yes
ptr_t *pstr = (ptr_t *)malloc(num_elements * sizeof(ptr_t));
I posted a codepad that verified that the diff is actually 8
yet this function is getting 16
@MooingDuck still don't work
 
@stdOrgnlDave define "don't work"
 
@MooingDuck exact same behavior.
 
Meh Facebook is worth $95e9. My ass.
 
7:41 PM
"don't work", verb phrase: order to not work.
 
@RMartinhoFernandes "idiom", A group of words established by usage as having a meaning not deducible from those of the individual words
 
@classdaknok_t Pascal syntax?
 
Can I get a dupe to close this?
5
Q: Handling variadic templates in c++11

Rondogiannis AristophanesI have recently started using C++11, and I have read in a tutorial about variadic templates. I have understood that we can define a variadic template like this // example class that uses variadic template template<typename ...Args> struct mtuple; But how can I handle the template argumen...

 
@Abyx too lazy to type out "billion" or "000000000".
 
@classdaknokt for your laziness you have now been forced to type both
 
7:43 PM
@stdOrgnlDave I don't care.
 
given an array where each 64-bit number is larger than the preceding one by 8,
walking in reverse we are skipping half of them
for some reason :-(
 
Use a smaller vector and print it out.
 
array is generated as so:
for (int i = 0; i < num_elements; i++) {
  pstr[i] = last_ptr;
  last_ptr = (ptr_t)&pstr[i-1];
}
yeah, fixed that array reference of -1, no difference made
 
knowing what I know about software without deadlines, human beings achieving immortality would be a disaster.
 
@stdOrgnlDave on my ideone it hits them all: ideone.com/wq7nn#view_edit_box I think it's your input that's bad
 
7:50 PM
Wrapping every file in the code base with #if 0 ... #endif.
Fun.
 
Erm, why not just exclude them from the build?
 
This is actually faster.
To do, I mean.
 
@stdOrgnlDave: Also be sure to test for dereferencing 0 and 1, because I'm not sure your code is right for those
 
Build system just recursively globs the root.
It compiles so fast.
 
Wait, if you #if every file out, what will there be left to build?
 
7:52 PM
`#define if(X) if ((rand()<RAND_MAX-1) && (X))
@RMartinhoFernandes but it made my machine build faster!
 
Well, not every file. I'm basically rewriting everything anyway.
ALL IS BROKEN THERE IS NO HOPE.
 
Hm... $ rm?
$ mv?
Branch?
 
I assume he wants to leave past code so he can update/fix easier
like comments
 
I need the old code nearby.
 
@MooingDuck Past code never dies. I mean, you have a VCS, right...
 
7:54 PM
No, there are little to no comments.
 
@CatPlusPlus old code is the comments
@RMartinhoFernandes .....right.
 
What code base is this, btw? GC?
 
Yeah.
Attempt-who-knows-what.
 
You're really determined, huh?
 
Probably only until Arkham City download finishes.
 
7:59 PM
@MooingDuck you're constructing your pointers forward, not backward
@CatPlusPlus arkham city is good.
 
@stdOrgnlDave so? THe point is the function you posted works exactly as described. Ergo, the input is bad
 
@MooingDuck yes, except it doesn't
 
It's 50% off, by the way.
2.3MB/s, hell yeah.
 
@stdOrgnlDave with the input in the code I linked, it works fine. Maybe you can show a SSCCE that displays the not-working behavior.
 
@MooingDuck ideone.com/AkEXL
not short
wasn't ever meant to be pretty, or useable
FINALLY figured ito ut
it was last_ptr = (ptr_t)&pstr[i-1];
it needed to be last_ptr = (ptr_t)&pstr[i];
 
8:15 PM
If I want to develop a library that will be used as a static library, I don't have to do anything too fancy in my code... right?
 
@thecoshman no
Well, not for gcc or whatever
I guess I don't know about windows
 
yeah, using gcc. I don't see the need to go through the pain of dynamic libraries for something like this
 
@stdOrgnlDave which, I observe, was not in the dereference function
 
@MooingDuck indeed, but the diff didn't complain before. it just started all of a sudden on ideone; in MSVC it was getting the correct numbers
@MooingDuck anyway, this can now be used to diagnose cache thrashing problems, believe it or not. woo and hoo.
@MooingDuck by randomizing the order of pstr[1]...pstr[num_elements-2]
real question: no overloaded instance of std::random_shuffle.
std::array<ptr_t,num_elements> *parray = new (pstr) std::array<ptr_t,num_elements>;
auto s = parray->begin()++;
auto e = parray->end()--;
std::random_shuffle ( s, e );
 
8:32 PM
guys
 
0
Q: Difficulty with pointers in C

Shankar Kumardouble volume(double l,double w,double h); double area(double l,double w,double h); int main() { double l,w,h,v,a`; volume (3.0,1.5,2.0); area(3.0,1.5,2.0); printf("The Volume is %lf cubic meters and the area is %lf square meters.\n", v,a); return 0; } double...

"The Volume is 2091994552961492532068352.000000 cubic meters and the area is 637485042878638687518720.000000 square meters."

damn... lol
2.09 * 10^24 cubic meters... That's a 100,000 km cube.
 
That's a large cube.
 
That's about the volume of Jupiter (1.431*10^24 cubic meters)
 
does the C++ library have a three way partition, or just two way?
 
partition? I must be really behind in my C++
 
8:39 PM
0
Q: Use std::random with std::array

std''OrgnlDaveI have code as such: typedef intptr_t ptr_t; const int num_elements = 100; ptr_t pstr = (ptr_t *)malloc(sizeof(ptr_t) * num_elements); std::array<ptr_t,num_elements> *parray = new (pstr) std::array<ptr_t,num_elements>; I'd like to be able to shuffle elements 1 to num_elements-2 , ...

fixed title
there, my second-ever question on SO
 
@MooingDuck Two way.
@Mysticial The <algorithm> header is lovely :)
 
Ell
hi guys
 
@Mysticial it does most of the work of quicksort all by itself
 
I don't like girls who program in C++, they put std's all over the place
 
@MooingDuck I use std::sort. But I wasn't aware of the partitioning features.
 
8:44 PM
@stdOrgnlDave I recommed you simply new sd::array<...> and avoid the soon-to-come comments about malloc + placement new.
Or std::vector. What am I smoking.
 
Oh, too late, people are already talking about it.
 
1
Q: Why am I observing multiple inheritance to be faster than single?

owaghI have the following two files :- single.cpp :- #include <iostream> #include <stdlib.h> using namespace std; unsigned long a=0; class A { public: virtual int f() __attribute__ ((noinline)) { return a; } }; class B : public A { ...

wow...
 
@RMartinhoFernandes: I optimized my O(1)-space-overhead "quicksort" a bunch!
 
8:51 PM
That question is begging for me... but I have no idea where to start...
 
10000
comparisons: 205525 std::sort took 0s. comparisons: 245941 inplace_sort took 0s.
100000
comparisons: 2711121 std::sort took 0.016s. comparisons: 3287756 inplace_sort took 0.016s.
1000000
comparisons: 26825742 std::sort took 0.094s. comparisons: 60468580 inplace_sort took 0.125s.
10000000
comparisons: 292684762 std::sort took 0.938s. comparisons: 3365334295 inplace_sort took 3.719s.
 
@MooingDuck Oh, that does look like a significant speedup.
 
@RMartinhoFernandes yeah, DFS quicksort > BFS quicksort
 
Oh, so this change stems from my comment yesterday about the quicksort-iness of the algorithm?
 
@RMartinhoFernandes no, I just realized I'd done it in a stupid way. It's also much more cache friendly than it was
@RMartinhoFernandes it's still as not-quicksort as it ever was
 
Ell
8:56 PM
OH! think twice.
Its just another day for you
 
Ell
you and me in paradise.
 
Are you singing along something in chat?
 
Ell
Yea :)
 
@RMartinhoFernandes ideone.com/4iCSo
 

« first day (565 days earlier)      last day (4385 days later) »