« first day (329 days earlier)      last day (4617 days later) » 

10:00 PM
Is association a concept that is used much in C++ ?
 
What do you mean by association?
 
I know nothing C++y by that name.
 
std::map and std::unordered_map maybe?
 
we once had to do some numerical computations for study
and I did it with haskell... but apart from that I didn't do anything with it
 
And I always envisioned you as the Templates/Type Classes god :(
 
10:04 PM
lol
@FredOverflow that would be Eelis I suppose
 
like:

class Class1;

class Class2
{
...
Class1 *c1;
};

class Class1
{
...
Class2 *c2;
};
 
@FredOverflow codepad.org/eaTObnDG
was for math homework
 
@ManofOneWay Well, you probably wouldn't use raw pointers in C++, but apart from that, sure, why not.
Oh wait, that's mutual association. That's rarely a good idea, regardless of language.
 
but I forgot everything xD
 
@FredOverflow But you have to use pointers in that case, right? You cannot use references when you have association?
 
10:08 PM
@ManofOneWay Right, because you cannot possible initialize both references at object creation time.
But we had this discussion already today. Why do you want to uses references when you need pointers?
 
AS IT is soo easy -.-
 
@FredOverflow I didn't know you had. I was just wondering if this is a concept used much in C++. I read about it today.
=)
 
Where did you read about it, and in what language?
 
In some C++-slides from a course
 
And what were the real names of "Class1" and "Class2?
 
10:11 PM
Person and Villa
So a person could own a villa, and a villa could be owned by a person
 
Do you realize that could be done for all relationships?
 
Whether or not it is useful to have pointers in both directions depends on the application, of course.
or mostly, on the algorithms
 
Most of the time, you only need one direction.
 
struct Person { virtual ~Person() {} virtual void addOwned(Ownable *) = 0; }; struct ManOfOneWay : Person { ... }; struct Ownable { }; struct Villa : Ownable { };
 
And it gets much easier like that.
 
10:16 PM
I'm not familiar with that syntax, could you create a struct with functions? And then inherit a struct?
 
Structs and classes are the same thing.
Are you learning C++ after C?
 
forget about the "structs are C, class is C++". that's bullshit
3
 
Funny how you can tell someone's background from the misconceptions they have about C++ :)
3
 
@RMartinhoFernandes If the world is yours, it will be constantly greeted by aspiring programmers writing their first programs ;)
 
10:19 PM
but a struct in C is obviously not the same as a struct in C++ then
 
@FredOverflow :)
 
yep, unions and structs in C are different than in C++
 
@ManofOneWay True. A C struct is valid in C++, but the reverse often isn't true
 
but the difference between a struct (C++) and a class is that all data inside a struct is by default public?
 
C structs have their own namespaces, that always throws me off.
 
10:21 PM
and not only data, but also functions
 
It's funny when you read D&E and see that people already had the same discussions 25 years ago :)
 
but when to use C++-structs instead of classes?
 
As you please.
 
@ManofOneWay when you like
 
10:22 PM
Some prefer to use the struct keyword when the class is a POD.
 
Well, there are two schools of thought. Some people say you should use struct for simple "C-like" types
others say "use struct when saves you some typing" ;)
I like structs because it defaults to public, and I prefer having the public members at the top of the class/struct
so using a struct saves me a line of code ;)
 
=)
so you could of course say

struct S
{

private:
...
};
?
 
i prefer to use "struct" for policies and simple things and "class" only for real business classes
 
@ManofOneWay Yes.
 
10:24 PM
exactly
 
@ManofOneWay in fact, S is a class
but it's not a class defined with the "class" keyword
this is an important thing to remember
 
They're all classes.
 
class is ambiguous, I only use struct and typename in my code ;)
 
so yeah, there's no fixed rule. When working in a team, try to stick to the same convention as the rest of the team. Otherwise, do what you find simplest and clearest
 
10:27 PM
I love C++ =) It's so complex, feels like there is so much to learn
 
@JohannesSchaublitb I FAQified that a few minutes ago...
 
@FredOverflow yeah I noticed
I think it was a good choice
 
Shouldn't we be noticed here?
 
@Feeds is getting lazy.
 
hmm, dunno how that works
 
10:28 PM
And I'm not sure it notices retags.
 
I downvoted one answer in that question too
 
@JohannesSchaublitb Well, many questions got closed as a duplicate of that one, so I figured it would be a good candidate.
 
17
A: What are the differences between struct and class in C++

KasprzolClass' members are private by default. Struct's members are public by default. Besides that there are no other differences. Also see this question.

but upvoted the accepted answer in that question
 
I had one spare downvote, so I downvoted this: stackoverflow.com/questions/92859/…
Now I'm exactly at 20.5k Internet dollars!
 
Do you guys have any suggestions of an application that I could write to really improve my C++ skills? It would be good if it also was some kind of application that would naturally be written in C++. All I can think of right now is some opengl application..
 
10:31 PM
I'm writing a BitTorrent client with the same objective.
 
I'm writing a transactional memory library ;)
 
I like to reinvent small templates like std::shared_ptr or boost::optional to polish my C++ skills.
 
@RMartinhoFernandes lol, lemme give that a -1 too xD
 
you could always write a game. Everyone likes a game!
 
10:32 PM
unless it sucks
 
@FredOverflow isn't shared_ptr like the one part of Boost that has been through the largest number of revisions and bugfixes?
 
@jalf Sure, but then I have to be creative too! :(
 
@jalf Yes, that's why it's an interesting challenge which never gets boring :)
 
make something absurdly overcomplicated with templates and metaprogramming then
 
Note that I would never use my own shared_ptr implementation.
 
10:34 PM
Btw, did they add some of the libraries from boost in C++11?
 
as standard?
 
13
Q: Solve the eight queens problem at compile-time

Martinho FernandesCan you solve the eight queens puzzle at compile-time? Pick any suitable output format. I'm particularly interested in a C++ template metaprogramming solution, but you can use languages that have similar constructs, like, for example, Haskell's type system. Ideally your metaprogram would outpu...

 
how about a compile-time implementation of, oh, an encryption algorithm, maybe?
 
10:35 PM
Besides the TR1 stuff, they added at least Boost.System.
 
You can start small :)
 
@FredOverflow oh yeah, or that!
 
@FredOverflow One day, I'll do the Haskell type system thing.
So far, I have the meta-naturals ready.
 
5
A: Compute the CRC32 table at compile-time

Johannes Schaub - litbA C++0x solution template<unsigned long C, int K = 0> struct computek { static unsigned long const value = computek<(C & 1) ? (0xedb88320L ^ (C >> 1)) : (C >> 1), K+1>::value; }; template<unsigned long C> struct computek<C, 8> { static unsigned l...

 
Oh there's a D answer there!
I would upvote it if it weren't for the snarky remark in the end.
 
10:38 PM
@RMartinhoFernandes Btw a bittorrent client, what graphics libraries or APIs are you using?
 
@ManofOneWay I think I'll use Qt, but so far I'm still working on the non-graphical stuff.
I have the networking taken care of, and now I'm working on the storage part.
 
template meta-programming -> guys, im off... :P
 
Sounds like a really big project =)
@jalf Where can I find more about your transactional memory library?
@jalf I'm not even sure what that means, is it some kind of safe mutex-lock, atomic, kind of stuff?
 
hmm, there isn't much info available atm, but here's what I have: jalf.dk/blog/stm
 
Wow
 
10:42 PM
also explains a bit what it is
let me know if it isn't clear. :)
 
TF, it's almost midnight. Who stole my time?
 
@jalf Your master thesis work has been removed, jalf.dk/stm
 
doh
I must have accidentally deleted it
 
I didn't say anything.
 
@RMartinhoFernandes the first url has a link to the second though
where I once had my actual thesis + the original code
 
10:46 PM
sorry, but what are hpp-files?
 
headers, same as .h
 
Usually, C++ header files.
 
.hpp just makes it explicit that it's C++
 
so why are they named hpp? =)
 
since the .h extension is also used for C
 
10:47 PM
ah okey
 
Some people also use .hh or .hxx. It's all down to personal preference.
 
@ManofOneWay the idea is to be able to modify variables as part of a transaction, so that either all your modifications are applied, or none of them, and all the modifications are made visible atomically
So it's related to locks and mutexes in that it deals with synchronizing access to shared data, but provides a completely different abstraction
 
Though I must warn you that .cc for C++ implementation files pisses me off to no end. Google Protocol Buffers, I'm looking at you.
 
@RMartinhoFernandes heh, why?
 
morning all!
 
10:50 PM
Can't tell. It's annoying for some reason.
 
@jalf So I guess you have to handle different $-lvl's in order to ensure correct modification?
 
@Paul It's about midnight.
 
doesn't bother me, but I generally use .cpp and .hpp
 
morning in here :)
 
dollar-levels?
 
10:50 PM
"cash", cache
 
as in CPU cache?
 
yes sir
 
I never saw a big money used as synonym for "cache".
 
@ManofOneWay ah, not really. CPU cache is designed to be invisible to software. It takes care of itself :)
have to be aware of it to avoid certain performance pitfalls, but it has no effect on correctness
 
10:53 PM
@jalf Invisible until it stabs you in the back!
 
@RMartinhoFernandes I don't believe it can
but each transaction has to maintain a buffer or cache of modified but not-yet-committed data
so there is some caching to keep track of, but only at the software level
 
That's a relief
 
@jalf Not in respect to correctness, but performance.
 
@RMartinhoFernandes true
 
The point of a cache is to speed stuff up, but it can sometimes do the opposite if you ignore it.
 
10:55 PM
yes, it's really hard, just change architecture and your cache optimizations might be the opposite
 
How can you work out triangular numbers? 1+2+3+...+n << When you know n
 
Tn = (n*n + n)/2.
Or something.
 
A triangular number or triangle number is the number of dots in an equilateral triangle formed from or filled by equally spaced dots. For example, three dots can be arranged in a triangle (see below); thus three is a triangle number. The nth triangle number is the number of dots in a triangle with n dots on a side. A triangle number is, equivalently, the sum of the n natural numbers from 1 to n. : T_n= \sum_{k=1}^n k = 1+2+3+ \dotsb +(n-1)+n = \frac{n(n+1)}{2} = \frac{n^2+n}{2} = {n+1 \choose 2} The rightmost term in the formulas, consisting of the two numbers n + 1 and 2 on...
 
> Hardware is sometimes even willing to change the meaning of your code, and possibly break it, just to hide memory latency and make the code run faster. - Herb Sutter
 
I just need to know the 256th triangular number
 
256(256+1) / 2
Did you even look at the wikipedia page?
 
Yeah but my brain's slowed down after my caffeine crash
 
@jalf Btw, it seems like a really fun master thesis to create your own C++ library
 
sbi
Good evening!
 
11:04 PM
Hey
 
sbi
:)
 
@ManofOneWay yeah, it was
 
@jalf I will do mine in about a year
 
fun enough that I kept working on it after finishing my thesis, even :)
@ManofOneWay cool. Any idea what about?
 
So is there 48 with 9900 0s different combinations of 256 0s and 1s?
 
11:06 PM
I can't parse that.
 
sbi
I have lovely visitors this weekend, we spent a grand day, and I was just checking on you guys before I go to bed. From what I can see you have been very talkative today, and I won't be able to read up on what you talked about.
 
@jalf not really, I'm more focusing on companies rather than ideas. I would love to work at Apple or Google (who wouldn't), and I would love to work in the US. I have a connection to IBM in the US, but also in a course I'm reading now we have a teacher that has worked both for Apple and Nvidia. So hopefully I can do my master thesis at some good company.
 
ah, here, they usually didn't have any kind of association with a company
I just picked a subject that sounded like fun
 
sbi
Hey, and I even got some rep on SO and PSE while not even visiting! How nice. Fits the great day.
 
Oh wait
 
sbi
11:08 PM
Anyway, I guess I'd better go to bed now. Good night!
 
@jalf Where do you work now then?
 
No I think that's right
 
@sbi Good night.
 
Night night
 
Good night
 
11:09 PM
Nevermind.
 
@ManofOneWay A small company that works with medical imaging
streaming of CT and X-ray scans and stuff like that
 
@jalf Cool, x-ray and stuff? So your days are filled with GPU coding? =)
 
well, I only started there a month ago, so not yet. ;)
some of the others are knee-deep in OpenGL and GPUs though
 
eve all
 
@RMartinhoFernandes But if you're using a 256 bit encryption key
Then surely there's only that many possibilities that it could be
 
11:11 PM
@KianMayne Nevermind what I said, I misunderstood what you meant.
 
@RMartinhoFernandes Oh
I was thinking that it would be
 
@KianMayne There are on the order of 10^78 different 256 bit keys.
 
Well like a combination lock
Oh right
 
@ManofOneWay One of my coworkers had just spent a few weeks struggling with Windows Installer and some boring date formatting bug. He really lit up the other day when his boss let him write some shaders for some of the GPU stuff instead ;)
 
11:13 PM
@jalf I haven't touched it that much, but I did have an assignment where I did some ray tracing and GPU coding. It was all about visualizing some 3d-xray scan.
 
Arrgh! Stupid WolframAlpha uses the stupid short scale!
 
@RMartinhoFernandes that is not a small number!
 
@RMartinhoFernandes But surely that's not right
 
@KianMayne That's the number of different 256bit keys.
@jalf It's way smaller than I thought. Stupid short scale.
 
Oh yeah I've realised my mistake
 
11:15 PM
@TonyTheTiger Hey
 
But that's still a shortish number hmm
 
hello
 
@KianMayne What?
Shortish?
 
@TonyTheTiger what's time over there? GMT+2?
 
I don't know if 2^256 is the right calculation
 
11:16 PM
@ManofOneWay I'm at GMT right now, I'm in the UK
 
@KianMayne It is. Why wouldn't it be?
 
Because say you had a combination lock
 
@TonyTheTiger Nice =) what are you doing there?
 
Of 0s and 1s
 
@ManofOneWay finding a job
 
11:16 PM
Yes, 256 of them.
 
5 digits would be equal to
No 5 of them
 
@TonyTheTiger that's cool. I believe it's a great experience to have worked in an english speaking country.
 
Yeah that is right I made the same mistake twice getting confused between values of bases
 
Time to sleep, good night !
 
11:19 PM
Regarding the "shortish": did you notice the remark in the bottom that says the number of atoms in the visible universe is ~10^80?
 
@TonyTheTiger And good luck with the job searching!
 
10^77 is big. The huge kind of big. The HUGE kind of huge.
 
@ManofOneWay I did live here for 10 years
@ManofOneWay thanks man
 
Yeah I agree
 
However, 10^77 is peanuts to A(4,2) :)
 
11:22 PM
Even if you can work through 9.8 million 256 bit keys a second
It would take 7.76566332 × 10^64 years to get all of them
 
Yes, brute forcing 256bit keys is not feasible.
 
5.64775514 × 10^54 times more than the age of the universe
 
And that thing is oooold.
 
@RMartinhoFernandes I'd figured out that much :L
 
11:25 PM
And now I fell obliged to link to this:
250
Q: Simple proof that GUID is not unique

KaiI'd like to prove that a GUID is not unique in a simple test program. I expected the following code to run for hours, but it's not working. How can I make it work? BigInteger begin = new BigInteger((long)0); BigInteger end = new BigInteger("340282366920938463463374607431768211456",10); //2^128 ...

 
My favourite part is
Assuming Moores law holds, it would be a lot quicker to not run this program, wait several hundred years and run it on a computer that is billions of times faster. In fact, any program that takes longer to run than it takes CPU speeds to double (about 18 months) will complete sooner if you wait until the CPU speeds have increased and buy a new CPU before running it (unless you write it so that it can be suspended and resumed on new hardware).
So my plan is
 
a snail just scared me shitless
 
What?
A snail?
 
yes a snail
 
A snail? :L
 
11:36 PM
I stepped on it and it went crunch
and then I stepped on another
and it freaked me out
 
Yeah, they tend to do that.
 
soooo nasty
 
I dedicate this song to you :)
 
heheheh
llulz
I've been in cyber space too long, snails start scaring me
 
Meatspace is scary by default.
 
11:38 PM
true that, interwebs is safer
lol
 
Surely botnets are ridiculously powerful for cracking encryption
 
Exactly what are you trying to encrypt?
The secret of eternal youth?
 
No just I'm wondering about how safe things really are
 
@KianMayne Read "Hacking Exposed" that will open your eyes, you'll never look at the interwebs the same way
Nothing is ever really safe
 
Anyone have numbers on the total combined computational power of the human race?
 
11:45 PM
Someone will always find a way to break your code, no matter what you do
@RMartinhoFernandes euh, you're the bot, work it out :P
 
We're currently using 0.16% of the total available planetary energy budget.
 
oh interesting fact
lol
 
If someone owned a botnet big enough surely they could break A LOT of passwords
 
2
A: C++ subclass access

David Rodríguez - dribeasDisclaimer: This is quite unrelated to this particular question, but more on the general problem that lead you to this and the other questions from today. I think that you are barking at the wrong tree here. I get the feeling that you provide access to your list's internal nodes, and then expect...

 
Now, let's see if I can find out how much is that budget...
 
11:49 PM
I wrote a comment to the OP there.
 
Got it: 1.74×10^17 W.
 
I wonder if I did the Right Thing™?
 
@KianMayne Problem is that passwords are not hard to break, cause people use shitty passwords, one guy had a yahoo database of email account passwords and wrote a GPGPU program to run on some hardcore graphics cards, and cracked a few million in about 10mins. That is scary shit, cause people have no idea about security
 
So, we're using about 278 TW.
 
@RMartinhoFernandes oh thanks
 
11:51 PM
Ok, now let's convert energy into processor speed.
 
@TonyTheTiger ­­Yeah - would you say it's similar to bicycle locks
 
@TonyTheTiger If you get pause of 10 minutes after each 3 wrong passwords, takes a long time to crack
 
Hackers will go the easiest ones to crack
 
@RMartinhoFernandes can you recite PI to 50 million digits for me, just for lulz
 
Anyway, the late Erik Naggum had the bright idea that with passwords, user names are superfluous.
 
11:52 PM
What?
 
@AlfPSteinbach true, but have you ever seen any email provider implement that?
 
How much energy does a typical CPU consume?
 
and if you have a database with email pswrds and usernames, those 10 mins don't even matter
@KianMayne I don't know, never cracked bicycle locks
 
@TonyTheTiger well, you can only check 6*3 = 18 passwords per hour per account, if server implements lockout.
 
11:54 PM
@TonyTheTiger Me neither but would they go for the easiest target
 
Ok, I'll go with 130W for a Core i7-980X Extreme Edition.
 
@AlfPSteinbach I don't think you're getting my point, you don't need to go and try it directly on the login, if you have the database with the psw hashes
 
If we suddenly decided to do nothing but computation, we could run 2.138*10^12 Core i7s without increasing our total energy consumption.
 
@KianMayne surely, but blackhats hack where the money is
 
@TonyTheTiger right, you're right. i misunderstood. jumping into discussion, sorry.
 
11:56 PM
So, how much processing power is there on an i7?
 
@RMartinhoFernandes hmmm interesting :P
@AlfPSteinbach :)
@RMartinhoFernandes mine is 1.7Ghz and 4 physical cores, 8 threads
 
@TonyTheTiger Both theories fit into what I saw when I had this: symantec.com/business/theme.jsp?themeid=deepsight-screensaver
The top 2 sectors every single day that were being hacked were always the home users and high revenue businesses
 
I got the power values for the Extreme Edition, so it's 3.2GHz, 6 cores, US$885 (just throwing the price here; cheap, huh?).
 
Oh and that screensaver I linked to always hid my taskbar when I resumed on Win 7 which is why I don't have it any more
 
@KianMayne yea, average home user is an easy target, and stealing a credit card number could always deliver cash, and high end businesses are very lucrative, though harder to attack mostly
 
11:58 PM
@TonyTheTiger Exactly :)
 
I'm deliberately ignoring the energetic cost of manufacturing that many CPUs.
 
@RMartinhoFernandes woah, that's expensive
 

« first day (329 days earlier)      last day (4617 days later) »