« first day (712 days earlier)      last day (4222 days later) » 

8:00 PM
@FredOverflow Cute. I guess they should be -- they're the only ones to publish a book that acknowledges me. I proofread a couple others, but for reasons unknown, they never got published.
 
Maybe you found too many errors?
 
@FredOverflow exactly it.
 
sbi
@FredOverflow I once was asked by some AW representative which book they could get me. So I looked at my list of C++ books I'd like to have. Turned out they were all by AW. (I sent them a list with a dozen books, hoping they'd sent me one, or two if I was lucky. They sent me the whole dozen.)
 
@CaptainGiraffe How do you know about Jerry's proofreading?
 
@FredOverflow I did my share
 
Xeo
8:01 PM
Holy shit. Seems we will get all our brackets in lambdas (yes, I just got to that proposal...) []<size_t N>((&a)[N]){ ... }
 
@sbi I know, you already told that story once.
 
@Xeo Might yet get rejected.
 
@FredOverflow Could be -- one I sent back had about as much red as black on some pages. Then again, the O'Reilly book I proofread got an email listing errors that was over 20 pages long...
 
Xeo
@DeadMG Sure, but I really hope it doesn't
 
sbi
@FredOverflow My point here was that, of the dozen books I wanted, a dozen were published by AW.
 
8:03 PM
@LuchianGrigore was just reading it somewhere and had this doubt. not worth to be asked on SO.
 
If it get rejected that can only mean we get a better proposal instead!
 
Xeo
heh
 
@JerryCoffin in this case it makes sense..
 
sbi
@JerryCoffin That was my proofreading story. Turned out well. The author was immensely thankful because my review was the most comprehensive by far (hence the offer to pay me), the books got published, I got a special edition of it, and a shirt, and I am listed twice in the acknowledgments. :)
@LucDanton Yeah, just like with concepts, right?
 
8:05 PM
Yeah!
 
@sbi How is that funny? :)
 
sbi
@FredOverflow I didn't mean to be funny, I was serious.
 
Can funny sbi come out and play?
 
sbi
@FredOverflow Too tired tonight. Also, distracted. I'm still crossing things of my todo list. (After doing them, that is.)
I have my last day at this job tomorrow. I will soon stop chatting and backing up all my personal stuff from this laptop. Then, after 3.5 years, I will hand it back tomorrow. Sob. Also, I plan to provide lunch. And there's all those last-minute things I need to give back or take home...
 
@sbi I have my last day of my current nebenjob tomorrow, but it only lasted 9 days :)
So, what job are you going to do after that?
 
sbi
8:12 PM
@FredOverflow I will do embedded stuff for a change.
 
@sbi What are you doing next? Are you a contractor? Self employed?
 
sbi
@Chimera Employee.
 
@sbi In C++, what type of hardware?
 
sbi
@Chimera In C++. Some proprietary hardware I had been told during the interview, but have forgotten now.
 
@sbi Work for a consulting company?
 
8:13 PM
anonymous unions - LOLLL
 
?
 
sbi
@Chimera Nope. I like to work for small software shops. The biggest I ever worked for had ~30 developers. I like it smaller.
 
@sbi Ah ok. So did you just take a new job?
Different company?
 
sbi
@Chimera "I have my last day at this job tomorrow." Since I have to feed a bunch of kids, I will have a new job when quitting the old one.
@Chimera Yeah.
 
I don't have a bunch of kids, but I'd still feel bad without a job.
 
8:17 PM
I'd feel bad without money.
 
I'd rather have a job I enjoy than a billion dollars.
 
sbi
It's not about feeling bad. There's just no way this could work out.
 
I'd rather have a billion dollars and never do anything again.
 
That becomes boring after a couple of weeks.
 
sbi
@CatPlusPlus Yeah, but you're a cat, you enjoy lying around sleeping all day. Primates are different.
 
8:18 PM
@FredOverflow Not really.
 
sbi
@CatPlusPlus Yes, they are!
 
Pfftbt.
 
With a billion dollars I'm sure most people would find ways to amuse themselves.
 
starred
 
8:19 PM
I'd just buy more games.
 
@FredOverflow With a billion dollars, I could pretty easily start a company where I got to do whatever job I enjoyed.
 
class Lounge
{
primate:
    ape sbi;
    human fred;
    // ...
};
 
I'd buy a race car and join some racing league.
 
@JerryCoffin I'm not cut out to be self-employed, way too much stress and uncertainty :)
 
sbi
Now half the messages on the starboard either are by me or about me. Too bad I have to leave now, otherwise I would take over the whole damn thing.
 
8:23 PM
@FredOverflow Starting with an initial investment of a billion dollars reduces uncertainty for quite a while, depending on how many others you decide to hire. But, having been self employed for a few years now, I guess I may have a different perspective on it.
@sbi G'night. Don't sob over the laptop -- tends to be bad for the keyboard (unless it's one of those waterproof Panasonics).
 
int code;
prefix = *p++;
while (p != end)
{
    suffix = *p++;
    code = find_code();
    if (code == CODE_NOT_FOUND)
    {
        simulate_output(prefix);
        add_entry();
        prefix = suffix;
    }
    else
    {
        prefix = code;
    }
}
simulate_output(prefix);
^ The essence of LZW. Just beautiful!
 
it appears to be disgusting C
 
LZW is surprisingly effective given its simple implementation.
 
@FredOverflow It's too bad the patent got such lousy reputation, because it really is a nice algorithm.
 
@DeadMG Is there any other kind of C?
 
8:26 PM
nope :P
all I'm saying is that I'm seeing little beauty
 
@JerryCoffin Well, the patent has expired eight years ago or something.
 
@FredOverflow With a billion dollars? I'd use it to find @DeadMG's real name.
 
@DeadMG You have to see beyond the curlies and the semicolons of the implementation to see the beauty of the algorithm!
 
Actually, scratch that, I already know it.
 
is anyone here familiar with OpenGL and VBOs?
 
8:27 PM
I'd use it to find where he lives. And then drink beer.
 
so I made a quick test about unions, I tried setting three values and printing them all:

`char c = 'c'`
`int i = 10`
`float f = 10.5`

and it printed:

emty space for `c`, 10.5 to `f ` and 1093140480
 
@BenjaminDangerJohnson I used to do OpenGL VBOs in Java a couple of years ago, but don't tell anybody ;)
 
@rogcg Isn't that UB?
 
fixed the order of assignments
just testing what happens
 
You can only safely read from the last value you've written to.
Otherwise it's undefined.
 
8:29 PM
whassup biatches!
 
@rogcg Show us the code, I don't understand what you're saying.
If you write to f, whatever you wrote to c and i before gets overwritten.
 
I'm just hoping to get some help on my OpenGL question stackoverflow.com/questions/12589240/opengl-vbo-drawing
 
what about the crazy value on i. what is that?
I mean, that long number
 
more or less I hit a wall and have run out of tutorials to compare with.
 
ok
im gonna post the code
 
8:30 PM
Dang, it seems almost everything I know about OpenGL is deprecated :)
@rogcg It's the bit pattern of the float interpreted as an int.
 
yeah, that is why I am having trouble doing research on my own. Just about all the old tutorials use deprecated functions.
 
here is the code paste.ubuntu.com/1231136
 
so it prints empty for c, 10.5 for f and the 1093140480 for i
 
@rogcg Probably the binary representation of f, casted as an int.
 
8:32 PM
Remember, the computer only knows bits, and the types are a way of consistently interpreting the bits. If you use unions, you interpret the bits inconsistently, and you get "funny" results.
@rogcg You will get the same output if you remove the lines 8 and 9 of the program.
 
@sbi Oh, a Dell. No loss there!
 
35 mins ago, by FredOverflow
user image
didn't know that.. heheh gonna try here. hahahah
 
sbi
@JerryCoffin I have had those for half a decade now, and the M6400 is an awesome machine. Breaks your back carrying it around, but that's well worth it.
 
@rogcg Wait, multi-characters constants? What?
 
@EtiennedeMartel where?
 
8:35 PM
@rogcg mytypes.c = 'test';
c is a char.
 
seriously.. i dont see any helpfull use in unions.. but only to save memory space in assigning variables.
@EtiennedeMartel so?
 
@sbi Apparently a lot of people like Dell's, but at least when I've looked, I've never seen one that impressed me as worthwhile at all. With laptops, it seems to be heavily a matter of timing though -- the last laptop I got, there's no way I'd want either its immediate predecessor or successor.
 
@rogcg You cannot safely store 4 bytes in a one byte space. It works here because the union is sizeof(int) large, which is probably 4 bytes on your platform.
 
@FredOverflow you created project euler?
 
@rogcg So you've defined one char, but you're trying to assign 4 chars to it (and something like 'abcd' gives IDB at best).
 
8:37 PM
@rogcg The char.
 
ohh got it
 
@rogcg That's the exact point: unions are useful when you have a value that can be one out of several types, and you don't want to waste memory for values that are not used.
 
@rogcg What? No.
 
But it's only safe if you only use one of its field at a time. Otherwise, it's undefined behavior.
 
@EtiennedeMartel looing for this point of view, it loks usefull..
 
8:38 PM
@rogcg The three assignments modify the same memory location. The members of a union are room mates.
 
Typical use is to have a union along with a enum inside a struct, and use that enum to know which field in the union is currently in use.
 
sbi
@FredOverflow Looks disappointed.
 
Keep in mind that you cannot put non-PODs in unions, so its use is somewhat diminished in C++ compared to C.
 
I set the value to the enum so I can check which one is the current element in use, right?
 
@rogcg Quite common, for one example, in compilers. As you parse, you build records of various symbols. One symbol will have one type or another, but not both (e.g., it might be a function or a variable or a constant, but not all three).
 
8:39 PM
@sbi If you're so sad about it, why don't you start Project Heuler? ;)
 
@EtiennedeMartel C++11 relaxed that rule.
 
Ell
can't find an eulerian trail for this graph :( imgur.com/aJuuY
 
sbi
@FredOverflow ROTFL!
@EtiennedeMartel Wasn't there a plan to change that for C++11?
 
@LucDanton Right, but you still cannot put std::strings and whatnot in there, right?
 
@EtiennedeMartel Well, yeah. Since the rule is relaxed.
 
8:40 PM
Really? How does it work then?
 
However, it's a bit misleading. You can define members of type e.g. std::string, but what you really get is storage.
To get a proper object you need to do the work yourself.
It's arguably the only sensible option and note that it's consistent with how it works for types like int; it just so happens that for those types construction is trivial.
 
Ell
I asked this last night but forgot. Why can't I read/write from different members of a union without UB?
 
@Ell What defined behavior would you expect?
 
@Ell What would be the semantics?
 
Oh, the technical reason is probably strict aliasing or something.
 
Ell
8:42 PM
well for like a long, changing an int part would alter the lower bits
or upper bits
 
If the compiler sees you modifying an int, strict aliasing implies that a long cannot be affected by that.
 
is the cplusplus site tutorial updated? is it good to follow that tutorial or not?
 
Ell
oh wait long = int on some platforms?
 
I'm almost finishing it and don't know if that is updated
 
@Ell The types are never the same. The sizes can be identical however.
 
8:43 PM
@Ell No, int and long are always distinct types. You can overload on them, even if they have the same size and the same range of values.
 
@rogcg cplusplus.com? This site is kinda shit.
 
LOL
 
@rogcg All C++ Internet tutorials stuck. What you want is a book instead:
1596
Q: The Definitive C++ Book Guide and List

grepsedawkThis question attempts to collect the few pearls among the dozens of bad C++ books that are released every year. Unlike 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...

 
I dont want to buy books
--------------------------------------------------------
A palindromic number reads the same both ways. The largest palindrome made from the product of two 2-digit numbers is 9009 = 91 99.

Find the largest palindrome made from the product of two 3-digit numbers.
 
You could always try the 3D Buzz C++ tutorial
it's actually pretty fun
but it doesn't teach you everything
just a good way to ease into it
 
8:46 PM
The sum of the primes below 10 is 2 + 3 + 5 + 7 = 17.

Find the sum of all the primes below two million.
 
Xeo
Lol, the greater<> function object proposal was written by STL. I just noticed that in the end when he got to the implementation and named the file meow.cpp.
 
WOW! project euler has cool problems. must resolve some later..
 
@GraceNote haven't really kept up with the discussion here, but for what it's worth, I'm with @sbi and @JerryCoffin on this: The homework tag served a useful purpose, and I thunk usefulness should count for something. Whether or not it's a meta-tag, and whether or not Jeff has said he didn't like meta-tags, that doesn't change the simple fact that the homework tag is useful.
Maybe it looks ugly and out of place to the meta crowd, but to those actually answering questions, it's a very useful guideline. And to those asking questions, it's a very useful way to indicate that you're only interested in a certain type of answer.
 
sbi
A wasp/yellowjacket, a penguin, and a gorilla agreeing on something...
 
@rogcg Why are you posting Project Euler questions?
 
8:50 PM
just showing other users.. dont want anyone to answer
just presenting them the kind of problems there
 
Beyond that, I can't really be bothered to fight for it. I'm tired of trying to pull SO in the opposite direction of the moderators and the meta crowd. You can have it. Do with it what you like. It's not like the site is suddenly going to fail all of a sudden no matter what
 
Because we have never heard of Project Euler before. Thanks :)
 
@FredOverflow I never heard about it. sorry. =/
 
We can see your removed messages you know.
 
I did solve a couple dozens a long time ago, but I lost my account. Then I started a new one and gave up after 4 answers :)
 
8:52 PM
@FredOverflow congratulations.
@CatPlusPlus i removed because I was afraid it could be understandable in two meanings, so to avoid discussions etc, I deleted it.
 
3
A: Improving my solution to Project Euler problem #1?

FredOverflowThe solutions posted so far seem a bit overcomplicated to me, so I thought I'd share my solution: sum_of_first_n_numbers n = n * (n + 1) `div` 2 sum_of_multiples max factor = sum_of_first_n_numbers (max `div` factor) * factor solution = sum_of_multiples 999 3 + sum_of_multiples 999 5 - sum_of_...

Apparently I solved problem 1 :)
@rogcg We from upon explicit delete in the Lounge. You should have made it a shared answer and just let everybody go out of scope.
 
dynamic linking is totally a really old thing, right?
 
Dynamic linking is not standardized, right?
 
yep
 
My first thought was "DLL hell".
 
8:55 PM
I'm just pissing all over the Strategy pattern
 
@DeadMG what's the problem with it?
 
You want dynamically linked strategies?
 
@rogcg Calling it a "pattern" is kinda like calling addition a "pattern".
sure, it might show up a bit, but it's so goddamn basic, that I really don't get what's special about it.
not to mention that calling it an OO pattern is even worse, since it far predates OO.
 
Today, I discovered the semicolon pattern. Every expression-statement seems to end with a semicolon. Developerkind needs to know about this!
 
indeed
I'm writing bits on my tutorial on "Patternitis"
 
8:57 PM
Design Crapperns
 
@DeadMG LOL not a very used pattern in procedural languages.
 
@rogcg Nor in OO languages (in well-written code).
 
@rogcg I have used the Strategy Pattern in C. Yay function pointers inside structs.
I didn't call it Strategy Pattern, though. I prefer to think of it as a function pointer inside a struct.
 
there's nothing fundamentally OO about the strategy pattern, nor is it a pattern. It's just a function that returns a function. I mean, congratulations, but...
 
@DeadMG How is the Strategy Pattern a function that returns a function??
 

« first day (712 days earlier)      last day (4222 days later) »