« first day (795 days earlier)      last day (4378 days later) » 

user142019
14:00
I'm considering using C++ rather than C for this.
anyone can help?
@Zoidberg'-- Finally, you have seen the light.
fuck
2
I can't believe I did not previously notice that
user142019
lol
now I'm hideously underprepared
user142019
I know what you mean. :^)
@Zoidberg'-- at long last
@DeadMG "this job requires strong Java knowledge"?
yep
You could just tell them "Oh, I thought you meant the coffee". But you better be prepared, in case they start asking about that.
lol
user142019
14:04
Awesome clang autocompletion in Vim. I totally forgot I installed that. :P
@DeadMG We can prepare you!
So, what is the purpose of Void class?
what is result of i = 1; ++i + i++ ?
Or, what is the best singleton implementation?
@Abyx no
Actually, it's probably 3
I don't remember if Java has all those operators but I think it's well-defined in that language.
14:07
@Pubby It's 4.
@Abyx isn't it UB?
@BartekBanachewicz dunno, it's Java
Are we Lounge<Java> now?
shush about Java. It's terrible.
14:09
MY NOSE HURTS
Or LoungeJavaLangSpecInterface
@BartekBanachewicz Lounge extends Java
user142019
Does std::unique_ptr have a member function that returns T*&?
No. How could that work?
14:10
@Zoidberg'-- what for?
@Zoidberg'-- it's unique, after all
user142019
sqlite3_open_v2 takes a T**.
lol, C API
2
suck a unique_ptr
user142019
So it would be nice if I could just do sqlite3_open_v2(file.c_str(), &db.get(), ...).
14:11
@Zoidberg'-- You can workaround it with conversions and shit. Ask the puppy, he's done it before.
user142019
Oh of course it doesn't work. Forgot about deletion. Muh.
sqlite3_open_v2 won't throw, so why care about exception-safety?
@Abyx OpenGL has rather nice C API.
It's C, why care?
lolololol
hahahhaa
lololol
14:12
@BartekBanachewicz ah, that one with global state?
@Abyx <flame war ahead> Yeah, which, compared to Dx, can be wrapped to OOD while maintaing sanity
@BartekBanachewicz DX is already OO.
...are you claiming you cannot OOPise OOPish API?
@Abyx Indeed, it's OO, but not D.
@Griwes Not in a sane way, no. (This particular API, mind you)
Define sanity.
14:14
I'm not sane, thus I can't.
Ladies and gentleman, I present thee: sanity.
Those who have used OpenGL certainly know what I am talking about.
That const GLvoid * pointer argument.
You know, the one that is an offset, not a pointer.
@R.MartinhoFernandes yeah, it's an offset
I agree that I would hang the person who called it pointer, tho.
it's, uhm, __based pointer. (in terms of VC++)
Maybe Java is washing my brain, but it really shouldn't matter if it is a pointer or if it is an offset
14:17
@Neil Of course it does.
@R.MartinhoFernandes He didn't use that function.
you're not supposed to add anything to a pointer, or at least imho, you shouldn't be expected to use it that way
An offset is something like 4.
A pointer is... something like &x.
@BartekBanachewicz Yeah, clearly.
@Neil umm? That's quite bs. It's perfectly fine to do pointer arithmetic
Then it should return a long, not a pointer
14:18
@Neil Duh, that's why it's completely fucked up.
@Neil It's an offset, but in memory
fuck you, markdown.
@BartekBanachewicz I know you can, just meant that it's problematic
If you need to access a series of pointers, you should access an array rather than incrementing a pointer, as I see it
@Neil It's noticeably slower.
Wut.
It's the same thing.
What kind of broken compilers are you using?
14:20
@R.MartinhoFernandes Consider Sum[i] = A[i] + B[i] vs *Sum++ = *A++ + *B++;
@Neil You have call that function like glVertexAttribPoint(..., (void const*)4); for example.
@BartekBanachewicz Yeah...?
@R.MartinhoFernandes Well, it might be outdated, but in 2003 the latter was around 2 times faster.
I can link you the paper I've read it in
2003 was... ten years ago.
Anyway, if you're using an iterator, you're implicitly incrementing a pointer.
I need gcc-4.7 -S -O2
Or anyone who has access to it. It's better to check than to argue.
That one's interesting. I'd like to see the assembler code from an OC.
14:25
@AndreiTita I'm dl-ing mingw right now. I don't have any VM here
or wait, there has to be an option to do it in MSVCC
hi guys
any good reversers here tonight?
no. This is C++ room, not Reverse Engineering lounge
14:29
@Dean like people who reverses rivers?
@BartekBanachewicz I don't see any noticeable difference.
...thanks. Now I wish I was much, much better at reading assembly.
f1 starts at _Z2f1PcS_S_: and f2 starts at _Z2f2PcS_S_:
ATnT syntax sucks =\
Assembly syntax sucks
14:32
16(%rsi) omfg. how sane people can use it?
@Pubby nah, it doesn't
@Abyx That is Intel syntax :/
@R.MartinhoFernandes wut?
@R.MartinhoFernandes It's AT&T. Intel would be [rsi + 16].
it's AT&T
I used masm=intel
GCC must be mad.
14:34
-masm=intel?
Just a quick question which came into my mind: How does VS 2012 support things like std::tuple w/o variadic templates?
@Griwes Yeah.
Wait, got it.
@Nils macros and magic
@Nils macros
@Nils And magic macros.
14:35
lol
@Nils Until latest patch, they had some black magic for standard library.
g++ -S -masm=intel => AT&T. g++ -masm=intel -S => Intel. Fuck you GCC.
4
bah make me puke
macros
@R.MartinhoFernandes w00t.
@Griwes what patch?
14:36
@R.MartinhoFernandes What about leaqs in first function?
@AndreiTita Latest. IIRC, they finally added variadics.
@Griwes Not in the standard library.
@Griwes They did add variadic support with the Nov CTP compiler but they specifically mentioned the std library hasn't been updated to use them.
Ough.
14:38
@BartekBanachewicz Sorry, I don't know much assembly.
@ abyx lol
@R.MartinhoFernandes Intel syntax shows the same. LEA stands for load effective address
lea rcx, [rdx+16] is rcx = rdx + 16, just short form of add
I don't know what difference it makes.
14:41
It's the main and only difference. With pointers, you don't have to compute the address
All the LEA instructions in f1
which are simpler in f2
L2 and L17 are the only different parts there.
@BartekBanachewicz Sounds like bullshit. Or you are not looking at the same thing as I am.
LEAs aren't that complex...
14:42
sub eax, 1
lea rcx, [rdx+r9]
add rdi, r9
lea r8, [rax+1]
add rsi, r9
xor eax, eax
There is only a difference in the labels Griwes mentioned.
Indeed.
And that's the overhead caused by the [ ]
    add     rax, 16
    cmp     rax, 992
    jne     .L17
    add     rdi, 992
    add     rsi, 992
    add     rdx, 992
    mov     r8d, 8
Why don't you benchmark?
vs those leas.
14:43
@Griwes and it should be faster.
@BartekBanachewicz huh? what overhead?
Seriously, lea rcx, [rdx+r9] is just addition.
There isn't even register move in that instruction, in sane CPUs (register renaming ftw).
@BartekBanachewicz I can run a benchmark if you give me one.
@R.MartinhoFernandes Can you just time the two functions you wrote?
14:44
@BartekBanachewicz time isn't fair, since it can be preempted at any given time.
not sure how that went
I need something that makes the results big enough to be noticeable and that makes external factors irrelevant..
@R.MartinhoFernandes Increase N?
FWIW, isn't this the loop part?
.L17:                                                    |.L3:
    vmovdqu xmm1, XMMWORD PTR [rdx+rax]                  |    vmovdqu xmm1, XMMWORD PTR [rdx+rax]
    vmovdqu xmm0, XMMWORD PTR [rsi+rax]                  |    vmovdqu xmm0, XMMWORD PTR [rsi+rax]
    vpaddb  xmm0, xmm1, xmm0                             |    vpaddb  xmm0, xmm1, xmm0
    vmovdqu XMMWORD PTR [rdi+rax], xmm0                  |    vmovdqu XMMWORD PTR [rdi+rax], xmm0
    add rax, 16                                          |    add rax, 16
Because I see a loop there.
14:46
You would have to boot real CPU into long mode and execute just them, reading HPET just before and right after loops, to truly measure it. </troll>
Seriously, the difference between those leas and adds is exactly 0 on any decently optimized CPU.
I will add some asm comments to see where the loops went.
guy didn't ask me any Java, really.
Wait, what.
Adding comments made the generated code much much smaller.
It fits on a screen now
lol.
14:49
@R.MartinhoFernandes that's why I hate asm.
What.
All I did was add asm("# im in ur loop") to the loop bodies.
Seems we have to add asm comments here and there to get ultimate speed-up of code execution.
Anyway, in neither version do I see any fucking difference in the loops.
Yeah.
=> we are not in 2003 o/
14:52
But I am a bit baffled by the different that the comments made.
Ask on SO! :D
The moral of the story is: don't use // ... nor /* ... */ for comments. Use asm("# ... ");
Hmm, that could make pretty good SO question, actually.
user142019
asm("# foo"); ain't portable.
14:56
Anyway, my tests using QueryPerformanceCounter give surprising results
Turns out the first code is around two times faster (opposite to what I said)
Or maybe I'm doing something wrong
I trust more my eyes upon exactly the same generated code than I trust microbenchmarks.
Anyway, show the benchmark code.
(And now you might understand why I did not want to write benchmarking code)
The results are consistent
Around 1.2M for f1, around 2.2M for f2
(on my PC)
with about 1% deviation
...now, -O3 or however you write that in MSVC?
15:01
@Griwes -O2 or -Ox
tried both
Oh, actualy "minimize size" slowed down the f1 to nearly the same as f2
0
Q: Why does adding assembly comments cause such radical change in generated code?

R. Martinho FernandesSo, I had this code: constexpr unsigned N = 1000; void f1(char* sum, char* a, char* b) { for(int i = 0; i < N; ++i) { sum[i] = a[i] + b[i]; } } void f2(char* sum, char* a, char* b) { char* end = sum + N; while(sum != end) { *sum++ = *a++ + *b++; } } I wa...

MSVC11 Debug(/Od): about the same; Release(/O2): f1 around 3x faster.
That's classic wtf
@Jerry congrats for passing 10k in
If you were a piece of cheese which cheese would you be?
> I think I'd be brie because I'm smooth as fuck.
15:06
What should I use instead of QueryPerformanceCounter to test this on Linux?
@R.MartinhoFernandes boost::timer
i should use it too, actually
@BartekBanachewicz There was a question on SO which answered exactly that.
@R.MartinhoFernandes std::chrono::high_resolution_clock::now();
15:08
Yeah, I think I had seen the first one before.
pastebin.com/eqiJqqv3 - something like that
[rmf@persephone ~]$ g++ -O3 a.c++ -lboost_timer -lboost_system
[rmf@persephone ~]$ ./a.out
 0.213092s wall, 0.210000s user + 0.000000s system = 0.210000s CPU (98.5%)
 0.210384s wall, 0.210000s user + 0.000000s system = 0.210000s CPU (99.8%)
[rmf@persephone ~]$
50 mins ago, by R. Martinho Fernandes
What kind of broken compilers are you using?
Answer is: MSVC.
user142019
What must the default ctor of a ForwardIterator do? Initialize the iterator as if it were end?
So f2 is faster by aroung 0.0027s :)
Wall time is always skewed.
Also, there are other factors involved. Look what happens when I test them in the opposite order:
15:14
user + 0.000000s?
[rmf@persephone ~]$ g++ -O3 a.c++ -lboost_timer -lboost_system
[rmf@persephone ~]$ ./a.out
 0.213450s wall, 0.200000s user + 0.000000s system = 0.200000s CPU (93.7%)
 0.210470s wall, 0.210000s user + 0.000000s system = 0.210000s CPU (99.8%)
[rmf@persephone ~]$
silence
anyway, g++ sucks and VC++ ftw. it may be broken, but it has decent IDE.
Please don't get me started on that.
ok
@R.MartinhoFernandes MSVCC sucks, but MSVS is the best money can buy right now.
15:20
That's from 2001!
Seriously.
Ok, so it's 12 years instead of 10
Anyway, it was a fun experiment to check that
Especially because MSVCC seems to produce strange results
> I had just gotten off a red-eye flight, and was in the airport bathroom brushing my teeth. When I spit it out, I still had some toothpaste on the side of my mouth. Some snobby lady looked over at me and said, "It looks like you have a little leftover on your mouth from your last client." I calmly wiped my mouth, turned to her and said, "Yeah, your husband doesn't have the best aim, does he?" Then walked out of the bathroom.
dayuuum!!!
@BartekBanachewicz Yeah, that's sad. It is also entirely different from saying it is great or awesome or decent.
@R.MartinhoFernandes I am well aware of it's imperfections.
The main problem is that M$ really wants us to use C# instead of C++.
what are you smoking?
15:24
@BartekBanachewicz um... lol?
if anything, MS are the ones who are waking up to the coffee that C# isn't good for everything by a very long shot
are you still living in that hallucinatory dreamworld?
> waking up to the coffee
lol
Or did you just go to "it doesn't matter if what I say is correct, as long as it's negative about Microsoft" school of online discussion?
user142019
15:25
Sublime Text 2 y u no Vim. I keep hitting cmd+w and as such closing the tab. T_T
@BartekBanachewicz @R.MartinhoFernandes MSVC assembly at its finest (/O2): pastebin.com/VmPVXnTg (I tried to figure it out for a bit but gave up. Maybe it's useful?)
It appears it does not vectorize f2.
but which MSVC?
Conclusion: that paper from 2001 is at best outdated, at worst wrong.
15:29
k
welp!
hats are addictive!
@AndreiTita 11 beta?
@jalf is it untrue?
Kids, the lesson here is: stop making silly senseless optimizations because some dude told you it was faster; especially if said dude told you that in another decade.
Yeah the last CTP
15:31
@AndreiTita Y U NO 2012? :)
What he said.
Umm, am I the only one around here that actually used VS 11 (after 2010 and before 2012)?
Wut.
Yes, you are.
Probably. I never heard of that.
user142019
Fuck you Java and your OutOfMemory exceptions.
user142019
Well at least it doesn't eat all swap.
@R.MartinhoFernandes They renamed it to 2012, yes
And the VS2012 uses v110 for toolkit name
@R.MartinhoFernandes I didn't use it; I just read it while surfing and it quite made sense
And your question has 23 upvotes by now :P
@BartekBanachewicz that Microsoft is pushing people to abandon C++ for C#? Um... yes? Unless you're living in 2006, give or take a few years
15:36
@jalf Compare C# and C++ support in VS. Look at "Windows 8" toolkit (pure C#)
@R.MartinhoFernandes Oh hell, it treates it as volatile? WTF.
It was a very useful question :)
user142019
I want virtual constructors in Java. I hate factories.
Microsoft is trying to make C# another Obj-C, but on the other side of the barricade.
@BartekBanachewicz What is that toolkit? They just launched a major new platform whose main selling point is that it is not limited to .NET in any way. And a number of functions are actually only available to C++ (DirectX, for example)
Xeo
Xeo
15:38
@BartekBanachewicz Right, because they don't have extensive tooling support for C++ means they want to push you away from it.
And honestly, it looks to me like most of the new stuff in VS11 is C++-centric. Yes, they have very nice C#-support, but they inherited that from VS10 and before
@jalf DirectX is available from C#, IIRC. There was something called XNA, and I heard that now you can use DirectX directly
plus, tooling for C++ is just harder
@BartekBanachewicz XNA? You mean the one that is deprecated and retired from Win8?
@jalf >There was something called XNA.
Yes, and what there WAS shows us absolutely nothing about what Microsoft is trying to do TODAY, does it?
15:39
The fact that there isn't anymore does not further the argument that they are pushing for C#.
Xeo
Xeo
+1 @jalf
Are you still mad at me for OGL vs DX discussion?
There once was something called MSDOS too. That is CLEAR UNAMBIGUOUS PROOF THAT MICROSOFT WANTS EVERYONE TO ABANDON WINDOWS AND USE DOS
3
@LuchianGrigore Thank you! (to be honest, I hadn't even realized until you said something...)
15:39
I like "punambiguous". Please leave that typun.
Windows Phone can be programmed only in C#.
@BartekBanachewicz I am not mad, I have just noticed a certain pattern in "discussions" with you
@BartekBanachewicz LOL
@jalf Frustrated much?
No....
@jalf :( You fixed broke it
15:40
@BartekBanachewicz WinPhone7 could only be programmed in .NET languages. WP8 can be programed in C++ as well (and some APIS are only available through C++)
@jalf That's new to me. And if it's true, thank god.
@BartekBanachewicz Yes it is fucking new to you because you are an ignorant troll who doesn't even bother to look things up before spreading his nonsense
Anyway, I am personally looking from customer perspective at VS. And I can see nice C# project options that open in tab and old project options unchanged from around 2003
Let's face reality: Microsoft's management is such a mess they quite literally don't have a clue of what they're going to be doing a few months from now (in fact, I'm not sure they entirely know what they're doing right now).
@BartekBanachewicz no you are not.... You are looking from a preconceived idiot's perspective
plonk
15:42
@jalf That's harsh.
@BartekBanachewicz He plonked you. He's not listening.
Wow, erm. What's the function to putting stuff in a set?
@DeadMG umm? I'm not familiar with "plonk"
@R.MartinhoFernandes insert?
@R.MartinhoFernandes insert.
@BartekBanachewicz It means he added you to his ignore.
Oh. I thought that was for ranges.
15:43
std::ostream has no public copy ctor?
@DeadMG Umm. Oh. Well.
@TonyTheLion No.
Xeo
Xeo
@TonyTheLion nope
@R.MartinhoFernandes It might be both. But it's definitely per value.
Xeo
Xeo
It doesn't make sense to copy streams.
15:44
@TonyTheLion Nope, streams are move-only.
posted on December 19, 2012

This week, I continue in our discussion of a bug in a multipass compiler.

@Feeds Yes I know what's broken.
Just as a historical note: in quite a few libraries there was once an iostream_withassign though.
Xeo
Xeo
What?
I guess I'll go spread my idiotic nonsense opinions somewhere else. See ya guys.
15:45
@BartekBanachewicz No, it is not harsh. You consistently do your best to ignore the evidence in front of you, solely because you want to bash MS. I am describing the behavior I've observed from you. If you want me to change my assessment, try a few more facts and a bit less trolling
and yes, I did ignore you, but since I can still see your posts, I must have misclicked something. Well done me
I'm heading home. Seeya
@jalf Later.
bb
the real question is
why am I using these tweezers to eat?
is DeadMG really a puppy?
user142019
Is the return value of operator* from an InputIterator allowed to be invalid after ++it?
yes
user142019
Thank God.
InputIterators can be rvalues
what is the type of vptr?
unfortunately, the other iterators currently must be lvalues
@TonyTheLion Of course.
15:48
lol
user142019
That simplifies everything.
@Amit0440 Since it's an internal compiler artifact, it doesn't really have a type.
@DeadMG Thankfully no one cares about that requirement :P (Which is why they are planning to get rid of it)
user142019
Otherwise I'd need to store the entire row in the result, now I can just store a pointer to the prepared statement in it.
I wish C++ had std::wexception with wwhat().
3
wwhat what in the bbutt butt
@TonyTheLion A "wide" version of what()
@JerryCoffin For DeadMG then.
@JerryCoffin but it must have a type ? i know a little bit that vptr is a internal concept of compiler
15:51
wut?
vptr is a pointer
enough said
@Amit0440 No, not really.
v* vptr
lol
@Amit0440 Its type would be something like a pointer to a tuple of pointers to functions, with the types of the pointers to functions determined by the types you defined for the virtual functions in the class.
static_assert(std::is_same<decltype(vptrof(T)), __magic const*>::value, "it's all magic");
15:52
@DeadMG vptr points to the vtable so the pointer must have a type ...my question is in this case what is the type of vptr
@Amit0440 It does not have to have a type.
@Amit0440 Only C++ concepts must have C++ types.
A vptr is not a C++ concept.
Xeo
Xeo
@Amit0440 You want a pointer type? void*, can point to all data stuff.
@DeadMG then what it is ...
Internal compiler magic.
15:53
@Amit0440 Magic.
The compiler is all powerful and needs no puny types.
WTF. std::string s(1000, 0); is making a string with size 1007 and capacity 761779504. Something is amiss.
Do any one here have idea about executing SNMP command through c++ program?
no
@R.MartinhoFernandes That's an optimistic memory allocation
15:57
I need to learn about the .dll i want to create and use them ...how i can start learning?
Buy book - read - understand - use
this way ^

« first day (795 days earlier)      last day (4378 days later) »