« first day (498 days earlier)      last day (4451 days later) » 

12:00 AM
That answer makes GCC look so incredibly dumb, even though it's right…
 
@sbi Impressive.
 
12:44 AM
@sbi 33 answers, how do you check the rep?
 
Alright guys, I got a request. Tomorrow, we got a competition and we must ask tricky questions to CS professors. If they fail to answer, we get points. We thought about asking really obscure C++-related stuff. Any ideas?
 
@EtiennedeMartel What kind of CS professors?
Just pick an area which they don't know.
 
See WTP'--'s top answers the one to Xeo's question about conversion to function pointers
 
You can also pick one of the two WTF performance questions that I answered.
 
12:49 AM
@EtiennedeMartel perhaps you can get Hoxieboy (or who was it) to dream up some pretty hard questions on French language.
 
Has anyone ever tested FastFormat?
I've one a very limited, short test in which it is similar in speed to iostreams, and far slower than stdio.
(Writing to /dev/null, that is.)
 
@KerrekSB: I've seen it
Thought it was intriguing but didn't bother to try it out
Is it really at the same level of speed as iostreams?
I thought the whole point of its existence was to be faster than iostreams
 
For a school project we had to do a fake interview with a real employer. The job was software engineer, and the employer looked like Peter Gibbon's twin. I really thought WTF?!
 
1:05 AM
Was it anything like how things are run in Office Space?
 
He didn't know what Ruby and Python were, so it was a bit chaotic. I would say maybe.
 
I thought I've seen the logo before (it's been a while since I've watched Office Space) O_O
 
That's the actual logo of Initech in Office Space.
 
Yeah I just realized that
 
@Insilico Maybe my tests are not very representative... but I'll spend a little more time on it.
 
1:08 AM
Who thought that it was a good idea to name their company after Initech?
 
The job was "iOS Engineer". He didn't know what iOS was :P
 
And use the exact same logo to boot?
How do you call yourself an iOS engineer without knowing what iOS is?
It's almost as though the company was founded as an IRL version of Office Space
 
He was the employer, I was the fake soon-to-be employee.
So I would become the iOS slave of his company, Scribd.
The job was from SO Careers :p
 
@daknøk So why the fake interview?
Is it part of a class or something?
 
Yeah, for Dutch class.
 
1:11 AM
Ah that makes sense now
 
I'm 17, I'm not yet allowed to work full-time, afaik. And really not as a software engineer.
 
Not sure if I can do a fake interview seriously with a company named Initech
 
The company was called Scribd. The guy looked like Peter, though.
That's why it was so humorous.
 
LOL
What was your initial impression of Scribd?
 
Same hair, same face, same I-don't-really-care-I-wanna-go-home-mentality.
 
1:14 AM
Would you take it if it was a real job, if you were hired?
 
Scribd is cool. I use it do download free books.
Yeah.
I like iOS development.
But the important thing is that now I know how interviews work, and what questions I can expect. That can help a lot when I have my first real interview.
 
That's good
The interviewer did give some feedback, no?
 
Isn't it true that when applying for a job as software engineer, they can let you write code on your interview?
 
@daknøk I think that's a requirement for a lot of software engineering positions
At least at the good companies
 
Yes. I got a grade for it. 7.5/10 so it was not bad.
 
1:20 AM
Do they usually give a grade on real interviews?
Usually they simply talk about what you made
 
I don't think so, but this was for class.
If I didn't get a grade, it would've been a 1/10 automatically and I would've been screwed.
 
I would be surprised to not have to write code when applying for a software engineer position
That's almost a good sign the company has at least a major WTF going on
 
If they ask me to write a TPS report on an interview, I'd immediately stand up and walk away.
Do many software companies expect you to wear a uniform?
 
That would depend on the culture of the company, I would think
I would at least go in a decent suit
 
I don't have anything against uniforms, but I prefer Iron Maiden, Slayer or Volbeat band shirts.
Suit was the word I was looking for.
 
1:26 AM
Ah okay
I don't think it hurts to ask (not the interviewer, but someone else working there)
 
Google explicitly says on their website that they don't care, as long as it's normal (i.e. no Borat g-strings).
It's half past two AM and sleeping is boring. I wish I had clang on my iPod.
 
1:45 AM
guys
please
riddles
 
lol
give me a riddle?
 
What goes blop blop, fizz fizz?
 
@JohannesSchaublitb I remember this lateral thinking riddle: A dead man is lying next to a pool with a towel wrapped around his head. What happened?
 
@StackedCrooked He died. That's what happened.
 
He didn't want to see himself dying
 
1:51 AM
Lol.
 
And why is my anime lagging... I hate it when subgroups encode OP/ED lyrics in a way that requires a 10 GHz machine to render properly - even with the latest codecs...
 
On my comp CPU usage is rather high due to big screen.
 
MPC fail... VLC managed to play it...
 
Why do you have a mask on
 
user406009
VLC plays everything.
 
1:55 AM
That's pretty much their slogan.
 
I like MPlayer OSX Extended, but lately it fails to decode audio for some videos. It just creates loud distorted noise.
It happened after upgrade to Lion I think.
 
The only thing my main desktop has a hard time with are - like I said - extremely fancy and poorly encoded OP/ED lyrics with all that fancy font
I like it, but some subgroups are definitely better at encoding it than others.
 
Lately there are also certain encoding options used that only can be decoded by ffmpeg on Windows.
 
How do I check if the value of char x is hexadecimal?
 
2:00 AM
> I use Clojure and not CL because:

It communicates well with Java, so I can outsource my coding
It has access to the zillions of java libraries that do all sorts of things, including Swing and Weka
Since it runs on the JVM, you can more safely assume that your **problem** will work everywhere
 
@Moshe char has a 8 bit value. It's up to you to interpret it as decimal or hexadecimal.
 
@StackedCrooked Ah, well I think the question is if the value is 0-9 or a-f
> Assume that x is a char variable has been declared and already given a value. Write an expression whose value is true if and only if x is an hexadecimal (Base 16) digit (0-9 plus A-F or a-f).
 
user406009
What about the isdigit function?
 
user406009
If it is not a digit, then it must be a hexadecimal.
 
@Moshe Literally check whether it's any of those as characters?
 
2:06 AM
@Moshe So char x = 'f'; is a hexadecimal? Doesn't make much sense imo, you need more characters.
 
For instance 0abd8 is '0', 'a', 'b', 'd', '8'.
 
Hrm...
@LucDanton No.
 
@Moshe Why not? Seems to satisfy the requirements.
 
Ok, well, let me see.
When I put in (x < 0xff) it seems to fails.
 
@Moshe 0xff isn't a character. I'm recommending character comparison.
 
2:10 AM
@LucDanton How so?
x < 'f'
 
user406009
@Moshe Are you talking about x as its integer value, or its character value?
 
Ah, I wouldn't recommend using < and the lot. Straight up e.g. x != 'f', or x == 'f'.
 
@EthanSteinberg I don't have any more info than what I posted.
 
@Moshe You can use <regex> to match it against [0-9a-fA-F].
 
We're talking about a simple C++ homework question. I doubt regex is involved. (Whoops, forgot to mention it's a homework question.)
 
2:13 AM
It really, really seems you're tasked with checking whether a character is one of several character values. Seems straightforward enough.
 
@Moshe Yeah, you and five hundred other people today...
if (x == '0' || x == '1' || ...
 
@KerrekSB Has to be an expression :)
 
user406009
@KerrekSB I didn't know you were such a fan of reinventing isdigit.
 
@EthanSteinberg That's locale dependent.
 
user406009
So set your locale to something sane then before calling isdigit.
 
2:16 AM
@EthanSteinberg Sometimes it is educational to do something in the Most Retarded Way possible just so you appreciate your own advancement of skill :-)
 
boolean isdigit(char x) { return x >= '0' && x <= '9'; }
 
I wouldn't use isdigit, but I'd take advantage of the character set requirements of C.
 
@EthanSteinberg Right, in an expression?
 
user406009
I am sure with enough commas anything can be an expression.
 
@LucDanton Drop the if! :-)
 
user406009
2:18 AM
Well almost everything.
 
@EthanSteinberg class definitions?
int a = struct Foo { virtual void bar(); }, 5;
 
And then start complaining about those freshly-graduated developers that make clever abuse of operator comma, right? :p
 
@LucDanton There should be a type trait thingy to enforce an ordinary comma
much like addressof
 
lol
 
lhs, void(), rhs forces built-in comma. Can't use void as a parameter type.
 
2:20 AM
@LucDanton Right. Now we just need a variadic version of that.
 
Comma is binary :p std::addressof isn't variadic after all.
 
std::one_after_the_other(lhs, rhs, ths)
@LucDanton Sure, it's variadic for all values of 1.
 
But argument evaluation is unsequenced!
 
@LucDanton It could be a macro maybe...
 
That's a riddle for you though: given a variadic pack, can you build an arbitrary expression using that pack?
 
2:22 AM
Probably... depends who's asking
 
I am!
 
(Nobody has ever given me a variadic pack. Usually I just get various forms of bills.)
OK then -- which expression do you want?
 
Prefix increment?
 
Like (5 + x)...?
 
++i
 
2:24 AM
operator++(x)...?
new T... :-)
 
That will fail for types with a built-in increment. More to the point though, that kind of pack expansion isn't allowed.
foo(x...) is allowed, foo(x)... isn't. Of course, foo(foo(x)...) is fine.
 
@LucDanton Replace operator++ by a suitable ld::preincrement<T>(t)....
 
@KerrekSB But since the riddle asks for arbitrary expressions, that would mean you have arbitrary suitable operators!
 
Yeah, and wrap the thing into ld::express.
Which creates (void(), x) from x.
@LucDanton That's what the ladies say of me!
So... have you got a solution?
 
Well, functor doesn't mean functional operator so I don't see how suitor means suitable operator!
std::initializer_list<char> { (++x, void(), 0)... }
 
2:29 AM
@LucDanton Hehe. Good. We'll have to use that some day. I think functor may well have meant that originally. I think it comes from category theory, too.
@LucDanton How ontologically gratuitous.
 
foo(x, y, z) doesn't specify sequencing while foo { x, y, z } does. Of course that's not available to functions.
Then sprinkle with void() and there you go. Arbitrary pack expansion.
 
Neat
Can't we put something trivial on the left?
Like an empty class with an empty list contructor?
@LucDanton Wait, is argument evaluation also unsequenced when it results from pack expansion? f(x...)?
 
struct unpack { template<typename... T> unpack(T const&...) {} };
 
@LucDanton That'll do. Maybe even with T &&.
 
Statically checking that each T is int (or some such) left as an exercise!
@KerrekSB Yes.
 
2:33 AM
@LucDanton How inopportune.
 
@KerrekSB It's the same. but T const& documents 'no mutating the parameters'. Arguably though you could put T and verify it's all ints anyway.
Also unpack( (++i, void(), 0)... ) has that unsequenced thing going for it, so I put the good version into a macro.
 
Hm, well, anyway, you can't store the result of the expressions, unless you were to construct a suitable tuple.
(Or a suiple.)
I guess two versions would be nice: one that discards the result, and one that stores it.
 
Well, I can do tuples::apply(operators::pre_increment {}, std::forward_as_tuple(x...)); for that.
 
@LucDanton Perhaps, but I was thinking about arbitrary expressions.
Anyway, next question: Can you have two packs of equal size and create a bool... pack from a... < b...?
 
If we want to stick with the original goal of arbitrary expressions (rather than functors), then tuples::result_of::apply<operators::pre_increment, std::tuple<X...>>::type tuple { ++x... }; but that's silly.
 
2:38 AM
are those all part of your own library?
 
Yes. Working from memory though so some details could be wrong. I'm not sure I have tuples::result_of::apply, but I should have tuples::result_of::transform. Which is the same, but with the arguments in the other order.
@KerrekSB std::array<bool, std::tuple_size<X>::value>> result { a < b... };
 
Could someone help this guy? He's cleaned up the question...
 
Or maybe that should be (a < b)...
 
@LucDanton That would be neat.
 
In this instance it's easier than incrementing, we can figure out the return type more easily.
 
2:41 AM
Oh no, I completely forgot to log out and go to bed.
 
It's trickier than it looks.
 
Better get it done now rather than leave it for another day.
I don't even need to expand any packs. I have just one bed.
You should put your library on that wiki thing.
 
I think I broke the chat for me
 
OK, I'm leaving this scope. Night all.
 
@KerrekSB Meh, I've written it for personal use. That would mean I would have to figure out e.g. licensing.
 
2:43 AM
@ScottW my picture isn't showing up XP
what would be a good utility to have when playing DF?
that hasn't been made yet... >:)
... eh?
 
3:04 AM
Dumb question.
I'm supposed to write a "driver function" to test a max function.
> Assume you need to test a function named max.
> The function max receives two int arguments and returns the larger. Write the definition of driver function testmax whose job it is to determine whether max is correct. So testmax returns true if max is correct and returns false otherwise.
I've tried:
bool testmax(int a, int b){
  return max(a,b) == (a > b) ? a : b;
}
Why won't that compile?
 
Is max declared?
Also, the error please.
 
@LucDanton max is declared, the system won't give me an error.
I'm using TuringsCraft, a system analyzes code and then tests it for correct output.
 
are you even using the function then? O-o
 
@Hoxieboy Good point. Lol. Not really. But meh.
 
Perhaps it's complaining that testmax doesn't have the behaviour of its requirements?
 
3:09 AM
@Moshe I mean literally, are you calling the bool or is it just some definition sitting in space?
 
@LucDanton probably. But I have no idea what that would be. When I hard code some values, here's what happens.
 
There's nothing wrong in terms of the language with testmax in any case.
 
Given:
bool testmax(int a = 2, int b = 3){


  int res = max(a,b);

	return res == (a > b) ? a : b;

}
They complain:
 ⇒     Your test is returning true for a version of max that
               returns an incorrect value for 1, 2
I haven't got a clue what context they're actually calling max in.
 
Can you peek at the source?
 
No, usually they show me something. In this case they don't. I'm assuming it's a standard iostream include and a main function. Also, including a using namespace std;
that about it.
 
3:13 AM
If there's no source though default arguments can't affect the resulting program. Unless they're using something esoteric.
@Moshe Can you not use that using directive? There's an std::max.
 
@LucDanton I don't think so.
> Assume you need to test a function named max . The function max receives two int arguments and returns the larger. Write the definition of driver function testmax whose job it is to determine whether max is correct. So testmax returns true if max is correct and returns false otherwise.
That's all I have to work with.
 
Sorry what?
 
@LucDanton That's the question.
I can't see the source, I can only wiggle some cryptic messages out of the compiler.
 
How can you tell there's a using directive anyway?
 
@LucDanton Other questions do show the source, and my professor (who is one of the programmers of this software we're using) is a fan of it for these kinds of exercises.
 
3:20 AM
You could try explicitly qualifying every instance of max so that it's ::max but I doubt that's going to help.
 
Tried it. I don't have any idea how to solve this one.
Something's wrong.
Ok, this problem is seriously broken.
If they keep calling max(1,2), then the order of the arguments shouldn't make a difference.
And hard coding 2 in there doesn't work.
Do they want me to call it multiple times?
 
What happens if you just return false out of curiosity? You could also make sure to write an incorrect max.
 
user406009
@Moshe I feel pity for you with all of these insanely stupid assignments.
 
@EthanSteinberg Welcome to C++ for Freshmen.
@LucDanton lol, let me try.
Remarks:
⇒     Your test is returning false for a correct version of max
 
What if you don't provide a max at all?
 
3:28 AM
@LucDanton I don't define max. It's weird because I'm not even actually calling it.
I think I am, but it looks like TC is changing my code before calling.
 
So I guess this is a test for the test driver.
 
Yep, hah.
I'm chatting with the professor now.
 
Okay so the 'problem' in this instance is that your testmax is incorrect. As the error message reported.
 
bool testmax( int a = 1, int b = 2){

return (max(a,b) == (a > b) ? a : b);

}
 
Those brackets have no effect. return (expr); is the same as return expr;.
 
3:34 AM
ok
 
shibboleet, it's cold
 
3:56 AM
@LucDanton - Wait, @Shog9 brings up a good point.
Given this implementation of max:
int max(f, s) { return s; }
And this implementation of testmax:
bool testmax( ){
int a = 1, b = 2;
return max(a,b) == ((a > b) ? a : b);

}
I'd be returning true when I shouldn't be, but I'm unsure why.
 
well, your fundamental problem is that you're only testing an insignificant range
the problem space is 2^(sizeof(int) * 2)
 
Well for input 1, 2 max happens to return the correct value. There's no way around that, that's something inherent in testing.
 
you need to, say, run a million tests with random as both arguments, and return false if it fails any of them
then you would have tested maybe a tiny tiny tiny tiny fraction of the problem space
 
i think there is a problem when what's tested is much simpler than the logic to check the result
 
it's always easy to create simple, but incorrect, functions
also, a simple way to increase your effectiveness is that max(a, b) should also be equal to max(b, a)
that will eliminate any implementations which bias one parameter over the other
 
user406009
4:08 AM
Next thing you know DeadMG will be suggesting for us to make sure that null really is null
 
@LucDanton - Got it!
bool testmax( ){
int a = 1, b = 2;


if(!(max(a,b) == (a > b ? a : b))) return false;

a = 2, b = 1;

if(!(max(a,b) == (a > b ? a : b))) return false;

a = 1, b = 1;

if(!(max(a,b) == a)) return true;

return true;

}
Well, the last test case is supposed to be a || b
but yea
 
It's hard to call that a test driver with a straight face tbh. Ah well.
 
@EthanSteinberg Actually, I'm fairly famous for not doing many tests compared to other Loungers
and yay, I managed to render the most hideous emoticon you can imagine
 
4:25 AM
@LucDanton Well, it passes the hw test. How bad is it?
 
Not that much.
 
@LucDanton Well, I see I can simplify those "not" operators.
 
You can work with the hardcoded values directly, too: max(1, 2) == 2 and so on.
return max(1, 2) == 2 && max(2, 1) == 2 && max(1, 1) == 1;
FWIW with a test framework you usually do CHECK_EQUAL( max(1, 2), 2 ); or similar rather than deal with returning a boolean.
 
I still think that for(int i = 0; i < 1000000; i++) { int a = rand(); int b = rand(); if (max(a, b) != max(b, a) || max(a, b) != (a > b ? a : b)) return false; } is a better test
 
It's a more comprehensive test. Make of that what you will.
 
4:31 AM
considering that the problem space is the range of int, squared, then testing only four values is an insanely miniscule test
it'd be like testing a compiler on only "Hello, World".
 
I'd rather not talk about testing. Plenty of literature, plenty of practices.
2
 
fair enough, it doesn't particularly interest me either
 
Unrelated but you wrote a silly if(foo) return false;, three shames on you! :)
 
why is it silly?
 
What do your test fixtures usually look like?
 
4:35 AM
I have test fixtures?
 
@LucDanton I'm talking about a homework question which is now, thank you, a thing of the past.
Ok, off to sleep. Lots of catch up to do tomorrow.
 
@Moshe I assume the whole lecture covers that (or will) yes.
 
hmmm
I hate having to make getters and setters
 
For some reason I haven't had that problem in ages. I need to get out of library space down to application space.
 
well
I have a class C which is composed of class B and class A, which are totally independent, and they both possess a property X
but C will only work if B and A possess the same value for X
which is rather ineffably annoying
 
4:42 AM
Write a constructor once, ask for client code to construct a whole new object to change just that property.
Congratulate yourself when you're done writing the constructor, curse yourself whenever you need to update the property.
 
lol
I think a simple getter and setter will survive
 
Right, but you need shared functionality between the setter and at least one constructor (the validation). More work!!
 
getter doesn't validate anything
the setter would only have to set both values
besides, I've decided that neither is necessary and I actually have a place where I can simply perform the copy at an appropriate time, so I'm just going to leave it as a public member variable
 
Joking aside, what I said is neat when there's one and only one property/value/member if you're willing to make the constructor implicit. You get operator= for free.
 
after all, I realized that it's more than possible I won't ever know what X is until later anyway
and it might not even be wise or possible to expose X to the user
 
user406009
4:47 AM
One possible design is that you have two "constructor(forget the design name) classes" subB and subA. B and A have constructors that take subB(or subA) and x
 
which rather handily solves the problem of how I'm going to expose it, not needing to do it in the first place
 
user406009
You code then constructs an A with the subA from the user and the X. It also constructs a B from the subB and the X.
 
user406009
Sort of like having your users able to specify some options, but your code handles the rest of the construction.
 
by the way
is it a bad thing that I'm migrating more and more towards various classes which are composed mostly of public member variables?
 
Probably. I like my class types to have invariants. Again, possibly more of a library space vs application space thing.
 
user406009
4:51 AM
(I think I used that design when making a VertexList class for storing OpenGL vertices. Users would create VerexListCreators, VertexShaderCreators, etc, then pass them to the OpenglHandler instance which would pop out VertexLists, VertexShaders, etc with the right member variables to point to the core OpenglHandler)
 
well, on another hand, then for me many of my public member variables have no invalid values
if you want some text, then there's no 32bit DWORD which isn't a valid text colour as far as I'm concerned
 
I do use 'dumb' aggregates from time to time. And std::tuple a lot.
 
also, I'm thinking of recursive binary division as a UI layout algorithm
is that a bad thing?
 
Don't know shit about the problem domain. It's probably great for algorithms, right. However I'd make sure to have a plan to convert whatever I use to store the layouts to your representation though.
 
well, I think it should work well, but I'm hardly an expert on UI design
 
user406009
4:57 AM
@DeadMG Why not use one of the already available GUI libraries?
 
do they hardware render to an interface so you can swap in any rendering pipeline?
do they have a modern C++ design?
cause I haven't seen any libraries which are both #1 and #2
 
user406009
Ah shoot, most bets are off once you are trying to use a GUI library with 3d.
 
oh yeah
tell me about it
whereas my current GUI code might not be capable of any actual user interaction, or element layout, or actually possess an implementation at all, but it is #1 and #2 :P
 

« first day (498 days earlier)      last day (4451 days later) »