« first day (466 days earlier)      last day (4482 days later) » 

user784668
3:00 PM
@EthanSteinberg Better compile times.
 
@WTP There's little point in having a property if you have to use the get() syntax to access it
 
user142019
@EthanSteinberg better introspection and reflection, dynamic dispatch, run-time creation of classes, method swizzling and all that shit you never use.
 
Everything has better compile times.
 
user784668
@CatPlusPlus Objective-C++ and C++/CLI don't.
 
@DeadMG You can use . to access them.
 
3:01 PM
Oh, right, and the third language nobody uses, too.
 
@RMartinhoFernandes Not with T*! mwahahaha
 
user406009
@CatPlusPlus Wouldn't Apple be using it? Aren't they the ones really pushing the stupid language for little reason?
 
It's silly that you can use . to access properties, but you must use the stupid [obj method] crap for methods.
 
user142019
Objective-C++/CLI.
 
3:02 PM
yeah but the point of objective-c++ is just that you can use c++ code in an objective-c project.
It is not meant to actually program stuff in it.
 
user142019
@RMartinhoFernandes you can also use . for any method with a signature of - (T)selector and - (void)selector:(T)val.
 
Yay for consistency.
 
Obj-C is an amalgamation of the worst syntaxes ever imagined.
I guess they should win an award for that.
 
blah blah
stop bitching and code something :D
 
user142019
I use Objective-C every day. The syntax is horrible, I agree.
 
user784668
3:04 PM
@CatPlusPlus It's still beaten by C++ in sheer ugliness, though.
 
user142019
@Nils k I'll code a bot that bitches.
 
Sure, but nobody argues C++ has a good syntax. :P
 
user406009
C++'s lambda syntax is wonderful.
 
user406009
Does everything you need it to do and simple to use.
 
user142019
3:05 PM
@EthanSteinberg you haven't seen Haskell's lambda syntax.
 
Really?
It could have been [captures go here] (args) => f(args).
Instead, it's verbose as fuck.
 
user784668
[=y] (int x) { return x + y; } vs \x -> x + y. Or wait. The second one should be written (+ y), without a lambda.
 
user142019
Clang has a language extension that uses ^(args){statements} for lambda's called blocks.
 
Yeah well Objective-C is based on C99. It is not a different language from C as C++.
 
That's for Objective-C, isn't it?
 
3:06 PM
yes
 
user406009
You guys are all complainers.
 
@WTP That's an old Apple extension. GCC has them, too.
 
0
Q: Iterate over all subviews of a specific type

NilsIterating over all UIViews in the subviews of a class and then checking the type in the loop using isKindOfClass made my code look redundant. So I wrote the following method which executes a block for each subview. @implementation Util + (void)iterateOverSubviewsOfType:(Class)viewType ...

 
user784668
@EthanSteinberg It's anything but wonderful.
 
user142019
However, some idiot thought it was a good idea to have a syntax like R (^identifier)(arg-list) for block types, like function pointers have.
 
3:07 PM
@WTP Still, that doesn't look like a big improvement over C++'s lambdas.
 
@RMartinhoFernandes That's a lambda expression, really
not a lambda function
 
user142019
@Fanael that's because Haskell has currying. C++ doesn't have it built in.
 
[captures](args) => expression isn't going to scale if you need a lambda with multiple statements
 
user784668
@WTP There's no currying in Haskell lambda.
 
although I guess arguably you could have had [captures](args) => statement
 
user142019
3:08 PM
@Fanael I was talking about your third sentence (after "or wait").
 
I think I should have a look at haskell or lisp some day..
 
float f = 0 is 0 here considered to be a float or int and should it really be intialialized to float f = 0.f to make it a float explicitly?
 
@DeadMG Well, my main gripe is having to write type names all over.
 
0 is always int.
 
user784668
@WTP But then, comparing it to C++ makes no sense.
 
3:09 PM
@RMartinhoFernandes That's more semantic than syntactic, IMO
 
user142019
Then you shouldn't have mentioned that.
 
@CatPlusPlus so does it have to convert it implicitly?
 
@WTP That's not currying, that's sections.
 
@TonyTheLion Yes.
 
3:11 PM
#pragma mark Some title
I like how that feature is used in Xcode, makes it easy to find stuff in large classes.
 
user784668
What do you guys typically write in the header comments?
 
user142019
@Fanael what the class does/is for.
 
What header comments?
 
user784668
The ones at the top of the file.
 
// <one-line description of contents>
// <this crap is in the public domain>
 
3:14 PM
I write header comments?
 
I prefer /// doxygen-style brief comment
 
Licence and crap.
 
Doxygen sucks
 
If I bother.
 
@WTP Does the . syntax to access properties also work on classes if the getPropertyname method is implemented as a class method (instead of instance method)? So far I didn't get it working here.
 
user784668
3:16 PM
Nobody puts -*- C++ -*- there? Whoa, no emacs users?
 
user142019
@Nils yes, but don't prefix it with get. Also, the method must be public when using dot-notation.
 
Emacs needs hints for that?
 
I only put vim modeline in files with non-standard extensions.
 
user784668
In .h files, yes. Otherwise they get treated as C files.
 
@WTP ah I thought you have to..
 
3:16 PM
/* XXX Library
* http://code.google.com/p/XXX-lib/
* (c) 2012 YYY. ZZZ License.
*/
 
And Emacs sucks.
2
Also, use .hpp.
 
Ah, I use .hpp.
 
you know
 
@WTP ah sure forgot that
 
now that I have a public source repository, I ought to licence my files
 
3:17 PM
If I need (rarely), I put vim modelines at the end.
 
user142019
@Nils remember that classes are just instances of their metaclasses.
 
user142019
In Objective-C, only strings, classes and metaclasses can be statically allocated. -_-
 
What is a metaclass?
 
user142019
A metaclass is basically the class of a class.
 
user142019
The class of the metaclass is the superclass of the metaclass' class.
 
user142019
3:20 PM
The class of the metaclass of a root class is the root class.
 
ah..
 
* renaming .h to .hpp in current project *
 
and when you compile does the compiler turn objective-c first into c and then compile it again?
because in gcc i see obviously only c calls..
 
user142019
@Nils cocoawithlove.com/2010/01/… explains everything you need to know about metaclasses.
 
thx
 
user142019
3:22 PM
@Nils it can do that. Note that sending a message in Objective-C (aka calling a method) just calls the function objc_msgSend with the parameters self (the receiver), _cmd (the used selector) and then the arguments you pass.
 
yes
 
so in other words, an enforced virtual cal?
 
user142019
So [[UIView alloc] initWithFrame:myframe]l gets converted to objc_msgSend(UIView, @selector(initWithFrame:), myframe);.
 
it can.. does it?
@DeadMG yes
 
user142019
@Nils usually not.
 
3:23 PM
wow, that must be slow as fuck
 
user142019
@DeadMG what would be slow? objc_msgSend?
 
for every function call?
 
user142019
@DeadMG for every method call.
 
same principle
 
user142019
But basically, objc_msgSend is written in assembly and doesn't touch the arguments passed to it.
 
3:24 PM
so what?
even if it took just a few cycles
 
user142019
It simply leaves them as-is and jmps (not calls) the implementation of the function.
 
that's still no inlining
 
@DeadMG Different design goals, objective-c is not made for fast code.
 
and a few cycles for every method is going to add up really fast
 
And it still won't matter. Now that's a magic.
 
user142019
3:25 PM
objc_msgSend is faster than C++ virtual method calls most of the times.
 
user142019
even with looking up the implementation
 
for every method call?
I doubt thatvery much
 
user142019
for every method call, yes.
 
user142019
Because methods can be replaced with different implementations at runtime, nothing can be inlined in Objective-C, except for C functions.
 
3:26 PM
PRECIOUS CYCLES.
 
wow
 
eh, it's not a huge deal
 
that must be even worse than Java
 
as long as it doesn't involve further pointer indirections or branches, it should be pretty speedy
at least on an pipelined OOO CPU
 
@DeadMG Don't worry, Obj-C runs on a Mac, so everything's fine.
 
3:27 PM
a few extra instructions can get hidden pretty efficiently
 
@jalf OOO CPU?
 
In Java's case, it'd be an indirection, which is pointer
 
Java method calls are probably more expensive, and it still manages to not matter whatsoever.
 
OOO==out-of-order execution
 
I'd expect that Java's JIT can do a better job
 
3:28 PM
@CatPlusPlus well, Java's probably would matter if the JIT didn't aggressively un-line them wherever possible
 
I was reading it as object-oriented-o...xymoron?
 
user142019
Here is a good article about how sending messages works in Objective-C, for those who are interested: friday.com/bbum/2009/12/18/objc_msgsend-part-1-the-road-map
 
read it
 
Honestly, my gut feeling is that even without Java-like JIT it'd be hard to design a benchmark where it costs more than a 1-2% performance
 
Because it doesn't.
 
oh wait, one little caveat, of course. The address you jmp to is passed as a parameter, right? If that parameter is pushed to the stack, you have a store-load dependency which is a lot more expensive
anyway, the number of instructions really doesn't mean jack on a modern CPU
you can easily inject a few instructions for every function call without making a noticeable dent in performance, as long as none of them cause a memory stall
and as long as they can be pipelined, of course. A sqrt would probably hold things up quite effectively :)
So the conclusion is: don't compute square roots as part of your function prologue code
 
I doubt the message dispatcher does sqrts.
 
lol
 
Wouldn't sqrt run on FPU?
 
@CatPlusPlus not if it's integer square root
integer division would be bad too, if you prefer that
pretty sure those aren't pipelined either
 
3:34 PM
@CatPlusPlus yeah, remember you can still simply call c functions, there is no need to use objective-c messages
 
user142019
Pronounce "sqrts" as if it weren't an abbreviation.
 
"Square roots".
 
squirts
 
user784668
lol
 
lol
 
user142019
3:34 PM
:p
 
What's so funny about that?
Am I missing something?
 
@RMartinhoFernandes missed psychologist appointments
 
hehe
 
user142019
I hate method names that are longer than 80 characters.
 
3:38 PM
How is that possible?
 
user142019
initWithBitmapDataPlanes:pixelsWide:pixelsHigh:bitsPerSample:samplesPerPixel:ha‌​sAlpha:isPlanar:colorSpaceName:bitmapFormat:bytesPerRow:bitsPerPixel:
 
user142019
That's a method name on the NSBitmapImageRep class -_-. It's 150 characters long.
 
@CatPlusPlus I hate you
 
That's a whole signature, not a method name.
 
user142019
It's not a whole signature.
 
user142019
3:40 PM
It's just the name of the method (aka the selector).
 
initWithBitmapDataPlanes is the name, the rest are arguments.
 
user142019
The signature is - (id)initWithBitmapDataPlanes:(unsigned char **) pixelsWide:(NSInteger) pixelsHigh:(NSInteger) bitsPerSample:(NSInteger) samplesPerPixel:(NSInteger) hasAlpha:(BOOL) isPlanar:(BOOL) colorSpaceName:(NSString *) bitmapFormat:(NSBitmapFormat) bytesPerRow:(NSInteger) bitsPerPixel:(NSInteger).
 
user142019
The arguments are inlined in the method name.
 
user142019
setEditing: and setEditing:animated: are two different method names.
 
Wanna see my C++ beat that?
 
user142019
3:42 PM
yeah
 
user142019
unmangled, of course
 
user142019
Oh wait, I remember now. This isn't an Objective-C room.
 
user784668
@RMartinhoFernandes That's nasty.
 
3:47 PM
@RMartinhoFernandes nasty
 
user142019
"__PRETTY_FUNCTION__" how is that pretty?
 
@RMartinhoFernandes A pox of angle brackets on you.
 
user142019
brb going to eat some stuff
 
3:56 PM
Hello, I was experimenting with the different mutex alternatives in boost. Mutex and lightweight_mutex. I made a small example ideone.com/UkLyR. The result is NOT what I expected. I expected the it would print c=0. It does not do this for the threads using boost::mutex::scoped_lock (the uncommented lines).
 
@RMartinhoFernandes I wonder if you can overload the ideone output buffer.
 
It does not compile on ideone but you can see the source code :)
What am I missing?
 
@RMartinhoFernandes ah, too bad: ideone.com/E8eFL
 
@rubenvb The hard part is not exceeding the 1024 recursion depth limit. I'll give it a try :)
 
If something is in detail namespace, you probably shouldn't touch it.
Also, you're creating unnamed lock objects, which are immediately destroyed.
 
3:58 PM
Ok, maybe not. But in the commented lines I use boost::mutex::scoped_lock and when running those two threads together the result can sometimes be 0, 10000, -10000....
 
So, nothing is really locked.
 
oops...
 
boost::mutex::scoped_lock(mutex); should be boost::mutex::scoped_lock lock(mutex); or whatever.
 
oh my god thank you :)
I really missed that.
 
Common error.
 
3:59 PM
:)
 
@CatPlusPlus no shit.
 
And C++ doesn't help to avoid it in any way.
 
SIGXFSZ is "exceeded file size".
 
Also, there's boost::lock_guard for scoped locking, dunno if that's better to use than internal type or not.
 
4:01 PM
@TonyTheLion That dumbass douchebag, he gets what he deserves.
 
I was reading the boost mailing list when I saw someone mentioning the lightweight_mutex (implemented as CriticalSection on Win32) so I just wanted to try. I always use the boost::mutex usually.
 
@RMartinhoFernandes Insane robot is insane.
 
user142019
C++ is insane.
 
you is insane!
 
31 mins ago, by rubenvb
@RMartinhoFernandes missed psychologist appointments
 
user142019
4:08 PM
I hate commercials that contain no humor.
 
The what?
 
stackoverflow.com/a/9003531/168175 - I know it's C, but needs more downvotes
 
user784668
This deserves an upvote for pure, untainted stupidity.
 
user142019
4:20 PM
It doesn't even answer the question.
 
understanding others code is seriously a hugeee pain rather than writing own code. Any advices please?
 
Look at one small piece at a time?
 
there is no advices
it's an Official Factâ„¢ that reading code is a bitch
5
 
user784668
@MrAnubis Give up.
 
@RMartinhoFernandes yes but while joining all pieces I keep forgetting about other previous pieces :(
 
4:26 PM
It gets easier with time. That's all I can promise.
 
yo, fuck my mother
 
Microsoft want my mobile number to give me a Windows Azure trial
 
lol
 
I'd really, really rather that they never had anything like that
 
4:28 PM
Wow.
 
user142019
What if you don't have a mobile phone?
 
well, exactly
 
user142019
 
isn't it enough that they also want my card details even though it's a free trial?
cocksuckers :(
 
user142019
Canceled downvotes, yes?
 
4:34 PM
@WTP What rep? He's at 1.
 
he was at 3
 
Ah, yeah, that's a cancelled downvote.
 
user142019
He was at 3 a few minutes ago, yes.
 
user142019
Fuck yeah, triggered a rep recalc and now I have 2 more rep.
 
It's a known bug.
 
4:36 PM
lol
 
user142019
Rep should be able to go < 0. Then just show it as if it were 1 in the view.
 
so I go hit the gym
bye
 
user142019
later
 
@awoodland I don't understand. I'm interviewing for a job in C++. If you want someone to be able to understand assembly, you risk them not being proficient in C++. Maybe you should ask relevant questions to prevent that?
 
@DeadMG , what about taking a copy of Azure?
 
user784668
4:37 PM
Now he's at 11 rep!
 
user142019
Who up voted that crap?
 
Fucking pity upvotes.
 
user784668
I did.
 
user784668
17 mins ago, by Fanael
This deserves an upvote for pure, untainted stupidity.
 
4:38 PM
ok, so he was wrong
 
lol
 
you guyz are playing volleyball with that guy's profile :D
 
user784668
Okay, I removed my upvote.
 
He's at 1 rep
 
I didn't downvote. I simply voted to nuke.
 
4:39 PM
pastebin.com/jEpXEiWY What does this do? It binds the camera downward?
 
user142019
@Xaade he deserves that.
 
Interesting, Boost.Range doesn't require a range to be equality comparable.
 
user142019
@DzekTrek it looks from the point specified on the first line to the point specified on the second line.
 
I see.
so it somehow binds the position of camera, right?
 
user142019
See it as "look at".
 
4:41 PM
it sets the projection matrix
 
@WTP He doesn't deserve anything. We deserve to be able to protect ourselves from his answer. There's no sense in committing retribution against an idiot. Idiots usually don't feel the pain of retribution anyway.
 
@awoodland It changes whatever matrix is current.
 
@MrAnubis I just had to star your comment
 
Yes, right that, @awoodland.
 
4:42 PM
@JohanLundberg What comment?
 
@RMartinhoFernandes good point
 
sorry wrong id
 
where the fuck is pencil when you need it.
 
user784668
@DzekTrek Behind you.
 
ok
now I'm pissed off
their Windows Azure tools won't install
 
4:51 PM
Mmm, candy.
 
I have a utility to pass the elements of a n-tuple to a n-ary functor, and now I'm writing a utility to adapt a n-ary functor into a unary functor taking a n-tuple, what's a good name for that?
 
they have a nice helpful post about how it's a known problem and please send my log files, except those log files don't exist
 
Some Microsoft software that fails to install properly? Well I never.
 
@Fanael , how strange, it was there. :D
 
and I want to sign on to their forums but they insist my Windows Live ID doesn't exist
 
4:53 PM
@LucDanton Tuplize!
Tuplificate.
 
and why do their stupid IIS websites have separate accounts?
the fuck is the point of all that Windows Live shit if I have to sign up again and again anyway?
Connect pulled the same shit, iirc
 
It's carefully designed to piss you off as much as earthly possible.
 
user784668
Where the fuck Clang hides its main function?
 
@RMartinhoFernandes I'll probably call it unpack. Because it unpack arguments before delegating to the underlying functor.
Use would look like range_algorithm(zipped_range, unpack(f));
 
4:55 PM
uncurry?
 
Yeah, that's tempting too.
 
user784668
curry?
 
user784668
What d'you mean by "unpacks"?
 
Let's go with that, unpack is too generic.
@Fanael Thanks for proving my point.
 
user784668
Nah, I just didn't follow this conversation.
 
user784668
4:59 PM
Today I feel like I have a big debuff to my comprehension skill.
 

« first day (466 days earlier)      last day (4482 days later) »