« first day (484 days earlier)      last day (4465 days later) » 

1:00 PM
Oh. Yes, then, but the syntax of LC is sort of secondary to the semantics. Semantically, you can rename any variable to a unique ID, and shadowing doesn't change that.
 
Why do people go for assembly code for implementing the atomic operation rather than going for spin lock ?
I think spin lock suits much better ..no ?
 
@ArunMu This is what we call a false dichotomy.
 
@Potatoswatter can you explain ? I didnt quite get it
 
@Potatoswatter How does that help anyone?
@Potatoswatter Stop pasting and explain the problem!
 
1:07 PM
1. Use an atomic variables library.
2. Use a mutex from a proper threading library.
 
@ArunMu The point of atomic variables is that you do not have any high-level synchronization.
Access to atomics should be "lock-free".
Practically, this requires certain special hardware instructions, but no loop.
(Like "clear pipeline, lock bus, write", etc.)
 
Why do you think you need to implement a pure spinlock? Spinlocks have problems that must be solved using assembly. Some architectures provide assembly primitives which you must access that way.
 
@KerrekSB: ok. So looping is one major difference betwen both.. right ?
 
@FredOverflow Hi, Have you read adam drozdek's book on algos?
 
@ArunMu No... the entire philosophy is a different one
 
1:11 PM
@MrAnubis probably not
 
Locking and mutexes are high-level synchronisation primitives.
Atomic variables do not require any synchronisation -- you just access them directly.
 
@FredOverflow I was reading it and found that it uses the maths terribly :(, So I was gonna ask you some good discrete maths book to you since you're the professor :)
 
Atomic variables with direct hardware support are like that. In the general sense, you might need a mutex.
 
Synchronisation is requires for complex stuff that you cannot control at a finer-grained level. Atomics are preferable when you have concurrent access, but they are more expensive than non-atomics of course.
So you wouldn't just make everything atomic, because that'd be ridiculous.
However, any sort of mutex data structure will actually need to be implemented in terms of something atomic, if you think about it.
 
Not just if you think about it — if you look inside one. However, that's not a logical necessity, as it's possible to make a really bad mutex using just a spinlock and preemptive multithreading.
Which I suspect is what @ArunMu is proposing.
 
1:17 PM
folks
 
@JohannesSchaublitb We the people greet thee
 
@KerrekSB & Potatoswatter: : ohhk.. thanks I got it. I completely misunderstood spinlock definition and got more confused when saw a assembly level implementation of the same which looked more or less like a lock free implementation..
 
i want a template<class T> using identity = std::identity<T>::type;
 
@KerrekSB & Potatoswatter Really appreciate your help . Thanks
 
@KerrekSB @Potatoswatter .
 
1:18 PM
@JohannesSchaublitb You want to make a template alias that points inside a template with the same name, in std?
Then local identity and std::identity have different semantics. One is a functor.
 
template<class T> using identity = T ??
 
@Potatoswatter identity<T> == common_type<T>
 
@JohannesSchaublitb Then you still need the ::type at the end, no?
Why not template< class T > using identity = T;?
 
yes
but if you now say template<typename T> using identity = typename common_type<T>::type;
you can omit both typename and ::type
and one alias that looks like template<typename T> using sfinae = identity<T>; for the lulz
 
lol - this guy is totally barking up the wrong optimization tree

http://stackoverflow.com/questions/9247897/performance-analysis-of-a-functionality-with-different-approaches-linux/9248155#9248155
 
1:27 PM
Boy do I suck at playing Mega Man 2 :(
 
@kfmfe04 He needs faster I/O? Tell him to get a faster GPU!
They have oodles of I/O
 
@Potatoswatter actually, he thinks by optimizing the assembly (CPU), he can get his application (which writes 10mln files) to run faster...
this looks pretty good
when my mom upgrades to iPad3, I think I'll take the old iPad and turn it into an arcade box
 
Yay, I defeated Air Man :)
 
hmm... ...this one looks better - looks like about USD$100

http://www.youtube.com/watch?v=am3Vwtuwfyw&feature=related
 
Should someone who proposes a 3D game as a highschool CS project and tags questions with "Javascript/Java/C++" be allowed to call themselves a "teacher"?
 
1:39 PM
A begginer question about pointer arithmetic:

int arr[3] = {11, 22, 33};
int *parr = &arr[0];
cout << "parr = " << parr << endl;
cout << "parr + 1= " << parr + 1<< endl;

when I do parr + 1 it gets increased by 4 (sizeof(int))

Wha is that so? Shouldn't I have to do that parr + sizeof(int), or whatever it's holding?
 
@KerrekSB Also, someone who can walk into a place like SO and be so clueless about their environment… he's gonna have his hands full coping with a bunch of teenage nerds.
 
@Potatoswatter Yeah, it is baffling.
@Potatoswatter He's only missing PHP as part of the project, which would be the only way to boost bafflement.
 
@Mihaela No, C++ is a high level language, you refer to objects, not bytes.
 
@Mihaela parr point to the first element of the array, and parr + 1 points to the next element by definition. There isn't any more explanation than this I'm afraid.
 
For example, if you go and recompile on a system where int is 64 bit or only 16 bit, the program should still do the same thing!
 
1:42 PM
To access the raw bytes of the array you'd use a char* pointer, not int*.
 
So it's a "intelligent" additon, great, I don't have to worry then when adding.
 
@Mihaela Classic "overthinking". C++ usually does "what it should do", and it's not actively fighting you.
 
Stay high-level!
 
@Mihaela Whenever you think you need to worry about some internal details, you're probably on the wrong track.
 
Thnx, I'm coming from Pascal, still struggling :)
 
1:45 PM
@Mihaela But Pascal arrays are even more high level… you even get to declare the lower bound and make it 1-based, if I recall.
 
@Mihaela - it's actually good to ask anything you feel is "unexpected" in C++ - due to its multi-paradigm nature and its still-mutating specs over 30 years, it's better to find out for certain than to assume too much in C++ (safer to ask/investigate)
even books you read on C++ may be out-dated, the language has been around for so long
 
Arrays using [] in C++ are considered a bit of a wart. Don't spend too much time and frustration on them. And check out std::array, aka boost::array.
 
@Kerrek SB, they are, and you can define your range like [2..4]
 
Pointers are worth investigating though. (Which includes investigating when they have a superior alternative.)
 
I'm trying to learn C++, and many paradigms are the same as in OOP Pascal (Delphi, that I'm coming from). Less typing though :)
Thnx guys, going back to learning C++ , will come back when in trouble :)
 
2:06 PM
Heh, MUMPS is also known as M
Did not know that but it makes perfect sense from a MUMPS perspective
 
What does H stand for from a MUMPS perspective?
 
I dunno
I'm afraid to go find out.
1
A: Can you change your skin in offline multiplayer?

JeffSorrowsUmm.. I have A.D.D. but the second paragraph has the information on why I'm endorsing an offline NAME change, instead of offline SKIN change. Also paragraphs will have a number from 1 to 5 of relevance but... probably will need to read it all, well here goes. [3.76] BRAIN STORMING/STORYTELLING...

 
Xeo
2:40 PM
@Pubby The fuck?
 
Aww, it was edited
 
2:55 PM
I wondered, does any of you know Android?
 
3:30 PM
@TonyTheLion Isn't it Java-based /shudder
 
I thought so as well...
 
@TonyTheLion I did some Android a while ago.
 
Wow, just figured out I can write a binary trait is_specialization_of to check whether a type T is e.g. an std::tuple.
 
3:56 PM
So in Pascal I can do this:

procedure testVoidPtr;
var
varr : Pointer; // void *varr
Arr : array[0..2] of integer; //int arr[3]
i : integer;
begin
for i := 0 to 2 do
Arr[i] := i + 10;
varr := @Arr[0];
for i := 0 to 2 do begin
WriteLn(Format('%d = %d', [i, Integer(varr^)]));
inc(Integer(varr), sizeof(Arr[0])); //cast varr as integer, not *int
end;
end;

in c++ the closer I came to this is :

void testVoidPtr()
{
int arr[3] = {10, 11, 12};
void *varr = &arr[0];
for (int i = 0; i < 3; i++)
{
cout << i << " = "<< *(int*)varr << endl; //typecasting
I would like to know how to cast varr as int
 
@EtiennedeMartel I heard that with Android it's much easier to get work
 
@Mihaela Why is varr void* to begin with? Just make it int*? Also, please paste code on a paste site.
 
Sorry about the paste site. The point is to have a void pointer. Like in Pascal when I declare ptr: Pointer, it can be pointer to anything. That's what I want to know how to do in C++.
I've just started learning C++, and would like to know how to do things I do in Pascal, in C++. Sorry where is the paste site?
 
ideone.com
 
Thnx. Will do that in the future.
 
4:02 PM
@Mihaela it's not safe to have void* because you loose all type information
if you want to be able to store any type, use boost::any
that is type safe
 
Is there any use for void* anymore?
 
for low level stuff in C sometimes
otherwise no
 
I know. I will probably never use it. I just want to know how to do it. So when I want to go to the next element of array (for example, if my ptr points to array) I would have to use + sizeof(whatever).
 
Well yeah, but I mean C++
 
@Mihaela Use templates.
 
4:04 PM
@Pubby never really found a use for it no
 
I'm not there yet. Just started learning C++, but will of course.
 
@Mihaela use a pointer of the type of your array
 
@Mihaela Your problem is that void *varr = arr[0]; should be void *varr = &arr[0];
Or just void *varr = arr;
 
@Mihaela If you just started with C++, then do not use pointers.
 
void* is not for children.
10
don't use it
 
4:06 PM
It will eat your soul.
 
It is, look above, it points to the address of the 1. element. I could have written &arr;
 
And then crap on your car.
 
heheh
 
I0m a long time developer in Pascal, I know pointers, just not in C/C++.
 
@Mihaela Oh, I must of copied it wrong. Your example compiles for me.
 
4:06 PM
well, PASCAL != C++
in C++, you don't need pointers
pointers are error prone
use higher level abstractions
 
You need pointers, you just shouldn't use them
 
@Pubby :)
 
use RAII
 
I will do all that you say guys, just working my way bottom-up.
 
you should get yourself a good C++ book
 
4:08 PM
@Mihaela I wouldn't recommend starting with the low level stuff in C++.
 
@Tony the Lion Thnx
 
885
Q: The Definitive C++ Book Guide and List

grepsedawkUnlike many other programming languages, which are often picked up on the go from tutorials found on the Internet, few are able to quickly pick up C++ without studying a good C++ book. It is way too big and complex for doing this. In fact, it is so big and complex, that there are many bad C++ boo...

A good way to find if a C++ book is good or not is to check if they make you learn pointers fast.
3
If they do, the book sucks.
 
@TonyTheLion very costly book !!
 
Effective C++ might be good if you know Pascal
 
4:10 PM
@MrAnubis Programming text books always are.
 
@MrAnubis it's worth it's money.
 
Thnx guys, I did order Effective C++, did not arrive yet :)
 
@EtiennedeMartel Do you reckon we ought to make that a sticky? It comes up at least 3 times a day lately
it might even be able to preempt a lot of needless back-and-forth that culminates in the eternal question "Is there a recommended book for (starters|the curious|learning templates|c++11 features)"
 
@TonyTheLion that's for sure , I have it's ebook version :)
 
4:12 PM
Am I silly for having at least 15-20 of these titles on my shelf?
 
@sehe perhaps it should be linked to in the newbie hints
@sehe no
 
@Pubby The chances of that being close to zero, of course
 
the more books, the merrier
 
@TonyTheLion That's a thought
 
I have 100+ (programming-related) books. I'm an addict. Not sure that's a good thing :)
 
4:16 PM
i got 19 programming related books
i guess im still a green grasshopper
 
@Johannes you're smart, I'm an addict :)
 
I don't own any :(
 
im dumb :(
4
thats why i always answer the simpl questions -.-
that you can answer just by learning the spec
 
lol
you're not dumb
STAR ALL THE THINGS
oh ghosh
 
@JohannesSchaublitb hehe
that's basically where my third monitor would be (if I had one)
If I ever regretted any books, it would be the datastructures book(s). Those haven't ever been useful to me and I didn't actually read them (fully)
 
4:25 PM
@sehe You've read (almost) all of those?
 
morning
 
morning
 
Was ist Natuur Encyclopedie, @sehe ?
 
Oh and that entire side of the book shelfs (floor to ceiling) is programming related (but as you can see it also stores my media and some spare cables). Granted that includes my 'Killer Borland C++ 4' and 'WIN32 API' bible, and 'Modula-2' , 'Prolog', and even (gasp) 'Van BASIC naar PASCAL' (guess what means).
@DzekTrek Wrong shelf
 
@sehe danke fur link
 
4:27 PM
@Pubby Absolutely. I did without the exercises for the SICP :)
@DzekTrek That would be 'Dank je wel voor de link' (Dutch!). Und auf Deutsch: 'Danke für den Link'
 
Yep, dutch and german are very similar, but because I don't know Dutch, I replied in German. :)
 
Oh and by horrendous mistake "Exceptional C++" is in German translation :) LOL. It was ok after 30-50 pages.
That should be apparent form the fact that the cover is oriented from bottom to top instead of the other books
 
more and more Germans omit using pronouns.
 
@sehe Heh, I noticed that.
Information from that UX SE site actually came in handy!
 
@Pubby I never orderd from amazon.de after that. I like my books in (the author's) native language.
 
4:34 PM
ahh... ...Prolog - haven't heard mention of that language for decades
iirc - you put constraints on the system and then Prolog will find a solution? I remember writing simple constraints so the Prolog system can solve the problem by instructing a monkey to place various items on top of each other to reach a hanging banana, for example...
 
don't even mention PROLOG
it's the worst language I could possibly imagine
 
hahaha - I wouldn't use it to build a real system, but it was fun to play with...
 
masochist
 
Ell
4:49 PM
hi guys
 
What the hell is it with those 16 flags?
 
some dude spamming hiscode
 
Are function pointers really discouraged?
I use em all the time in c but in c++ their a bad idea..?
 
yeah
use std::function<...> instead
function pointers can't, for example, be a member function
 
Ell
I have never really looked at std::function
 
4:58 PM
or a lambda
 
Ell
does it wrap a function pointer or it a language feature?
 
neither, it uses inheritance, I think
but it's definitely not a language feature
 
Basically it's an object that implements operator().
 
Ell
ahh okay - so virtual functions?
 
It writes the functor for you.
 
Ell
5:00 PM
ohh kk
 
It's also made of win.
Honestly, I stopped using function pointers unless I'm doing interop with C.
 
Ell
does it have a lot of overhead? (just curiosity, nothing evil here)
 
not really
 
It has some overhead. But it's nothing serious.
As always, profile it if it's that important.
 
certainly not significantly more than a function pointer
 
Ell
5:01 PM
yeah
boy do I hate having a cold -.-
 
Colds usually last one week.
Seven days of pain.
Don't worry, you'll survive.
 
Ell
yeah its just a nuisance -.-
 
personally, I just hate life
 
Ell
@DeadMG same. have done for many months
 
ever since I got to university
 
5:05 PM
Damn, so much angst in here.
Feels like a shounen manga.
 
Ell
haha never seen
@DeadMG whats wrong with university?
 
their idea of an examination is "Did you memorize the textbook?
 
Perhaps your university sucks, ya know.
 
I guessed that
 
sbi
@sehe You have Münchhausen next to your C++ books? Oh boy, that really is telling.
 
Ell
5:07 PM
@DeadMG which uni are you at? So I don't go there.
 
which country are you going to study in?
 
Ell
the uk. I think
 
Loughborough
 
Ell
@DeadMG really!? My brother is currently at loughborough studying civil engineering :D
maybe you know eachother
maybe we know eachother o.O
 
unlikely
 
Ell
5:10 PM
wouldn't that be strange :P
 
no
 
Ell
why not? o.O
 
Six degrees of separation, eh?
 
@sehe two books of yours are also my books xD
 
anyway, if you're planning on studying CS, I would avoid it like the plague
 
Ell
5:11 PM
haha okay
 
@sehe Ha, the only book we have in common is Refactoring.
 
Ell
and why so blunt o.O?
 
@EtiennedeMartel I have it too. Never really read it.
 
because it makes me grumpy
 
Ell
@DeadMG your uni?
 
5:12 PM
yes
 
Ell
meh. what were your other choices, or weren't there?
 
I was gonna go to Bristol but didn't get the grades
 
DO YOU BELIIEEVE IN LIFE AFTER LOOVE
 
so it was the best I could do with the grades I had
 
I CAN FEEL SOMETHING INSIDE THAT SAYS
I REALLY DON'T THINK YOU'RE STRONG ENOUGH, NO
 
5:14 PM
Somebody reeks of alcohol.
 
Ell
:P
 
Hey, it's a catchy song.
 
well
I thought it was the best
it was the highest in the league tables
still top 10 in the UK for CS
I thought I'd done pretty well
 
@sehe hmm actually it is 3 ones
 
Blech, academia.
 
5:16 PM
but of course, when you go to the open day, they don't give you exam papers from previous years for you to look at
 
Ell
yeah :/
my other brother could be on his way into imperial
 
and they don't say "Sorry, our admin staff are hideously incomptent"
 
Ell
hopefully I will follow him in the later years :D
 
@DeadMG Aren't they all?
 
quite possibly
 
5:23 PM
@sbi It is the children's version. I have two kids <6 yrs and cramped for shelf space (I have 2 movers boxes of them stuffed away because there isn't enough room left)
 
sbi
5:43 PM
@sehe I used to have the same problem and fought it by putting up shelfs in the corridor above the doors.
Shelf space is still limited, though.
In Nov I reorg'd my books, thereby creating 2m of free shelf space. Now half of this is already used up, and my neat order wrecked. Damn!
 
@sbi you luring you. but the book titles are more or less unreadable...
 
@sbi Now that's what I call efficiency.
 
sbi
2 days ago, by sbi
@thecoshman My parser threw an std::exasperation_error while trying to make sense of that sentence.
Oh, it's so heartwarming to find the #bluescreenofdeath alive and well (as it were) in Reading. http://t.co/Ek5QIMWN
@terryandrob It's even more interesting when Network Rail ticket machines show "Found new hardware"
That warrants the obligatory:
 
@sbi That's a cute Twitter avatar (if that's what they call it), but I'm not sure how to make sense of it.
 
anyone know if this is normal for perlin noise? img269.imageshack.us/img269/551/perlinbug.jpg
 
sbi
5:54 PM
@LucDanton Make sense of the avatar? Well, Pratchett has Alzheimer, and cannot type anymore, and this Rob guy, from what I understood, is his secretary. This has been his avatar for a while, I think.
@TonyTheLion I'd be in favor of that. Better yet, link to the FAQ.
Mhmm. That said, don't we already do this?
No, indeed not. Would you add a section on that, @Tony?
 

« first day (484 days earlier)      last day (4465 days later) »