« first day (515 days earlier)      last day (4440 days later) » 

2:03 PM
pfft
they should have just fixed the library instead
 
How so?
 
the fact that iterators suck and non-polymorphic lambdas are gimped are problems for everyone trying to use the Standard library in all it's functionality
special-casing a solution for for_each is just trying to band-aid the most glaring problem
the proper fix would have been to introduce ranges and keep polymorphic lambdas, so you could do std::for_each(c, [&](auto&& var) { ... });
not to mention not having to do all the ADL cockery that makes range-based for "work"
 
@DeadMG “al the ADL cockery” … but ADL was already implemented. Why not make use of it? It comes for free.
 
probably because it's a bad thing?
goto and macros are already implemented, so why not use them?
 
oooh, declaring functions as override is a nice touch. helps prevent silly mistakes, potentially
 
2:14 PM
@DeadMG Why is it a bad thing? ADL is the bee’s knees as far as I’m concerned. Oh sure, it’s hell to implement correctly but once there it’s pretty nifty for users
 
@KonradRudolph @MG Have to agree with Konrad here
 
it's much too far-reaching and unreliable
never seen those dozens of questions about where ADL pulls in many more overloads than you really want or need and causes ambiguous code?
or worse, when it randomly calls another function because it's a better match than the one you intended to call?
 
@DeadMG If that even is the case. Isn't that a call to do namespaces properly?
 
namespaces are fin
the problem is that ADL looks up into them much too greedily
 
huh, TIL technically, C++ supports GC
 
2:26 PM
in the form of smart pointers?
 
> It is implementation-defined whether unreachable dynamically allocated objects are automatically reclaimed.
 
"supports" is a little much there :)
 
> “I had hoped that a garbage collector which could be optionally enabled would be part of C++0x”—Bjarne
 
more like "allows"
 
If only there was a C# that was not part of .NET...
you know, compiled to native code.
 
2:33 PM
then it would still have that enforced-class bullshit, weak-ass generics, and no decent support for deterministic destruction
 
@thecoshman fortunately, clang won't implement it. :D
 
on second thought, if only there was a C++ that didn't have pointers, had modules and garbage collection.
 
Having a GC in C++ urges people to use pointers and new.
 
but if C++ doesn't have pointers in the first place?
 
@IntermediateHacker: It doesn't if you declare as a project policy not to use them!
 
2:43 PM
@IntermediateHacker GC is less useful than people assume. One of the biggest hurdles in large .NET projects is … resource management.
GCs can take care of one type of resources only: memory. Managing unmanaged resources in .NET is a major cause of headaches and weird design decisions.
And having pointers isn’t the problem either. They are simply much too prominent. For instance, it makes no sense for a language to offer dedicated syntax for pointers. Why have int*? ptr<int> would be completely sufficient (and would discourage rampant usage).
 
I am wondering about function argument lookup. I have this code ideone.com/WQkd3 Why is the non const version of the template get_ref preferred? Does the function overload work from the inner most to the outer most or the other way around?
 
@KonradRudolph Because there's no way to implement ptr<int> as a library?
 
func_const(get_ref(ptr))
 
@DeadMG But of course there is. I did it in VB6
 
@KonradRudolph Which is what exactly?
 
2:47 PM
@DeadMG Store the address internally as an integer, use OS API to implement allocation and deallocation
 
ah
 
@DeadMG In fact, it makes sense to logically decouple the concepts of a “heap storage buffere” and an “object address” (a weak reference)
 
so how do you go from an integer to T&? and how do you get the address of arbitrary objects?
 
@KonradRudolph isn't that what unique_ptr is?
 
Isn't the point that the language syntax is ptr<T> instead of T*?
 
2:49 PM
@thecoshman Not quite, a unique_ptr owns memory … it’s a resource manager, not a pointer abstraction
 
@KonradRudolph And I did it in QB back when I didn’t know any better.
 
@KonradRudolph ah, technical points always get the better of me :P
 
@DeadMG Using reinterpret_cast
 
so
you want to go reinterpret_cast<T&>(address_as_int);?
 
@DeadMG Hmm I think you lost me there. You want to … dereference the object or what?
 
2:51 PM
on a some what memory management sort of subject, what are the c++ views on immutable objects, lets say a 4*4 matrix
 
well, yes, I want to know how you'd implement operator& and operator*
 
What exactly is the problem with having ptr<T> (and ref<T>) syntax be built-in along the very same lines as *_cast<T>?
 
that of course also needs OS API, forgot that (or compiler intrinsics, which I didn’t have iN VB6)
be right back, teatime
 
@KonradRudolph So, you'd swap out the T* compiler intrinsic function for, like, __getaddress(obj) compiler intrinsic function?
not really seeing the point
@JonPurdy Nothing, really. All I'm saying is that there's no way to implement ptr<T> or ref<T> as part of the library, making the difference rather pointless.
 
Might not be what you are talking about but I have a question regarding a get_ref<> function to a boost::shared_ptr. Look at my question and code above. Disclaimer: Might not be what you are talking about
 
2:55 PM
@DeadMG The point is that having dedicated syntax for it is a waste of compiler builder resources, bloats the language and incites users (not only inexperienced onces) to overuse the feature
 
if I was going to answer it, I would have done when you originally posted it
@KonradRudolph You haven't changed anything. All you've done is replaced T* with ptr<T>.
it's still a language feature
 
Furthermore, I abhor unnecessary exceptions to the compiler rule system
@DeadMG That is a change.
 
not really
"Special language syntax A" -> "Special language syntax B"
 
quick question... how hard is it to fake knowing learn Iphone dev?
 
“it’s still a language feature” – with a consistent declaration syntax
how is that syntax special? It’s just a class template
 
2:57 PM
because there is no possible implementation of ptr<T>
 
@DeadMG Even if that were true (and I’ve proved you wrong already) that is irrelevant to the interface
 
without effectively implementing T*
@KonradRudolph All you said was "OS APIs for alloc/dealloc, and compiler intrinsics."
well, I've got news for you
__magic_get_address(obj) is not different to &obj
 
@DeadMG I see a huge difference … how can you fail to see it?
 
uhhhh
because they perform the exact same function?
and people are still going to need them in the exact same scenarios?
so everything is going to be the exact same before and after?
 
There isn’t an inherent difference.
 
2:59 PM
@DeadMG I certainly hope so. I never claimed they shouldn’t
 
@KonradRudolph Then what have you gained?
 
sbi
@KonradRudolph And then what?
@thecoshman Rather boring and mind-numbing. (Is there any other way to travel by train/plane?)
 
The difference is purely syntactic, I never claimed differently
 
nothing!
 
sbi
@IntermediateHacker I was hard at work.
 
2:59 PM
you've gained absolutely nothing
 
sbi
@RMartinhoFernandes Don't be proud. He even thinks so about his own. :)
 
and it's not even consistent, because you're pretending that it's a library feature when it isn't
nobody can specialize ptr<T>, or implement their own, or anything like that
 
@DeadMG I’m not “pretending” anything. I’m merely offering a consistent syntax across the type system
@DeadMG Wot? Of course they can
 
but they're different things
 
No
they are fundamentally not different things
 
3:01 PM
@sbi spice it up a bit next time and where a clown suit... a satanic clown suite :)
 
@KonradRudolph Uh, no. There's only one way to implement ptr<T>, and that's __magic_get_address
 
a pointer isn’t necessarily a special type
 
sbi
@thecoshman Wear should I where that?
 
it offers semantics that cannot be replicated without special compiler support
 
A pointer is absolutely a special type!
 
3:01 PM
therefore, it is a special type
 
@DeadMG Nonsense. You get misled by your misnomer “magic”. There can be multiple implementations of this function
What allocators do now already
 
You need at minimum a way to get the address of an object, to read from an address and to write to it.
Which we have, by way of &x, *x, and *x=y.
 
@JonPurdy If that’s your definition of special then vector is also special
 
@KonradRudolph Except that basically no allocator actually does that
 
… or in fact every type with a well-defined interface
 
3:02 PM
@sbi gees, I only just learnt when I should use where, give me a braek :P
 
@DeadMG Does what?
 
and the ones that do just use pointers internally
 
and @sbi, ALL the places!!!
 
@KonradRudolph Replace the pointer/address type/functions
 
sbi
@thecoshman Yeah, let's have a braek and a tae!
 
3:03 PM
I mean, iterators
 
how do you implement them? pointers
 
@KonradRudolph …no. A pointer type is a fundamental aspect of the language that cannot be emulated. A vector can be (read: is) implemented in terms of those core features.
 
sbi
@EtiennedeMartel Where?
 
there's no possible way to implement iterators without pointers
 
3:03 PM
@sbi In my head.
 
@DeadMG Or completely differently
 
sbi
@EtiennedeMartel They must be small then.
 
@EtiennedeMartel There are some in class over here
 
Ba-dum-tish.
 
you cannot implement an iterator without a pointer
 
3:04 PM
@sbi :'(
 
@JonPurdy No. It’s not fundamental, and it can be emulated. Like I said, I did it in VB6 …
@DeadMG What the heck are you talking about?
You can implement iterators as reference + index for instance
 
@KonradRudolph No, you can't. What happens in assignment? You can't assign references. You can't keep a container reference in your iterator, because then it cannot be assigned to, which breaks the iterator requirements.
 
Whatever. Use a pointer then
 
see? all you've achieved is "Screw pointers, I'm gonna ... use pointers!"
 
but this doesn’ t have to be a T*, it could just as easily be a ptr<T>
 
sbi
3:05 PM
@thecoshman I had cream tea on Monday, with a pretty decent Darjeeling, some nice scones, clotted cream, and a nice selection of jams and marmalade. Yum. I liked that a lot.
 
but those are exactly identical in every respect
 
nothing here requires that pointer needs to be a syntactic intrinsic
 
@KonradRudolph What, using GetProcessHeap() and functions from kernel32? How did you take the address of a variable that had already been declared?
 
@JonPurdy VarPtr
 
@KonradRudolph Possibly because there is no way to implement it without an intrinsic.
 
3:07 PM
… aand we’re turning circles. Yes, there is a way, with OS functions.
 
the only thing you can do with them is allocate and deallocate
the OS does not provide __magic_get_address
 
and yes, there is no (smart) way without OS functions or intrinsics. So what?
 
@KonradRudolph Exactly. A function that was intrinsic to the runtime.
 
So all you've done is said "I'm gonna pretend that pointers are part of the library when they're not!"
 
@JonPurdy It’s just a library function.
 
3:08 PM
congratulations, you've lied to the user for no benefit
 
@DeadMG You have a weird conception of what “lie” means
I never lied to the user
 
well, you have syntax which implies that they are just another library function when they are, in fact, absolutely not
 
I merely said that “ptr is a type. You should love and cherish it as a type amongst types”
 
@KonradRudolph It’s in vbrun.dll (or whatever it was called). It’s not “just a library function” because it’s a direct hook to the language runtime environment.
 
and it is not OK in any way to perform normal library template functions like specialization
 
3:09 PM
@DeadMG I’m emphatically calling bullshit on that. The distinction is irrelevant to users of the language
 
But yeah, pointers don’t need to be syntactically intrinsic, sure.
 
@DeadMG Is there any problem with that?
 
@EtiennedeMartel Yes.
people should know what is safe for them to mess with and what is not
 
@JonPurdy Yes, I’m aware of that. But that doesn’t matter to the user’s perspective. VB is (in DeadMG’s words) “lying to me” because it presents it not as an intrinsic, but just any old library function
 
How so? We're already telling people to use std::array instead of raw arrays and std::vector instead of dynamic arrays.
 
3:10 PM
@DeadMG Explain please, I don’t buy it. How can documentation not clarify this?
@EtiennedeMartel Didn’t you get the memo? std::array is eeeeeevil
 
@KonradRudolph Because we should totally require that people read the documentation, instead of making it obvious that it has special semantics just by looking at it?
@EtiennedeMartel FTR, I also think that both of those situations are broken.
 
@DeadMG Yeah, I was pretty sure you'd say that.
 
@DeadMG If you want to mess with the internals? Yes, absolutely, read the docu. If you want to use it? Then where is the issue? Again, I don’t see it and you refuse to tell me. What “special semantics” does ptr have?
 
@KonradRudolph There's no indication whatsoever that ptr<T> is an internal.
 
Why should it matter?
 
3:12 PM
jee, I don't know, the whole "Use it wrong and UB" thing?
 
@DeadMG Can you tell me once and for all why there needs to be such an indication?
 
or the whole "Practically every library you'll ever use depends on this thing having the exact same semantics as normal, so touch it and UB?"
so basically, the "Do anything with it except pretend it's a language feature and never, ever go near it and UB"?
 
@DeadMG Two objections: (1) as if UB has ever deterred C++. (2) It’s a standard library type. The same claim is true for all other standard library types: touch it, and all bets are off
 
@KonradRudolph UB should be minimized. The fact that UB is necessary in a language is not an excuse to ejaculate it al over.
 
As far as I'm concerned, the standard library is part of the language.
 
3:14 PM
and secondly, it's perfectly legal to specialize Standard library types and functions for your own types.
 
@DeadMG … like the whole of the standard library, currently?
 
@KonradRudolph I also think that many facets of the existing Standard library are broken.
 
@DeadMG Yes. But the answer is not to “make all STL types syntax intrinsics to prevent them from being abused” … it’s to rigorously address UB where possible
 
@KonradRudolph Yeah, except abusing std::vector is possible. Abusing ptr is practically guaranteed.
 
@DeadMG I don’t agree with this assessment
In fact, I see rather less problems
 
3:17 PM
@DeadMG Again, how so?
 
it's possible to write past the bounds of a std::array, but it's practically guaranteed to happen with T[].
 
ptr would still be a pretty fundamental type that not many people would touch … and maybe that fewer people would use. So if anything I foresee less problems
 
Eh? It's the same thing. If you don't check your bounds, you're screwed.
 
@EtiennedeMartel As I previously mentioned, the slightest change in semantics would instantly invoke UB in massive proportions.
 
For example...?
 
3:18 PM
@EtiennedeMartel Well, gee, maybe because there are no sane semantics for a pointer other than the ones which currently exist, I don't even know why you'd want to or what you'd change them to
but when somebody goes ptr[index], then they'd better damn well know what indexing does if they want to avoid UB, hmm?
@KonradRudolph Everybody will still use it exactly the same as they did before- when they need it. Which is frequently.
 
Yeah, well, C++ isn't for young children.
 
@DeadMG So don’t. change. them. Easy as π, no?
 
@EtiennedeMartel There's a difference between "Errors can happen" and "Please, create huge errors that will destroy my program if I sneeze."
 
@DeadMG Exactly. And one honkin’ good way to achieve is to disincentivise the syntax for overrated constructs
 
@KonradRudolph Then what the fuck was the point? All you've achieved is a different syntax which implies things about what you're using that are not true.
you're not gonna achieve anything. People use pointers because they need them. Incentives have nothing to do with it.
 
3:21 PM
@DeadMG You still claim that, you still failed to support that claim
Yes, all that differs is a syntax. This is on purpose
 
@KonradRudolph You haven't supported any claim that any syntax change would have any reduction in the number of users.
 
And no, it does not imply anything which isn’t true
 
yes, it does
 
@DeadMG True, but I think it’s wildly more plausible than your claim
I may be wrong … this wasn’t my central claim, feel free to discard it
 
well, congratulations, I'm now trying to argue against your personal subjective feelings?
what a waste of time this was
thanks, buddy
I feel like this was an effective use of my time
oh, wait
 
3:22 PM
@DeadMG No. From the beginning, this wasn’t my central claim
don’t erect a straw-man here
my claim was that I want a consistent syntax for type declaration
 
@DeadMG: Luckily enough, it was your choice to argue. So you can't blame anyone else :)
 
your claim was that consistency isn’t good … you still haven’t shown why
 
@IntermediateHacker There is.
How do you think MonoTouch works? There's no CLR for iOS.
@Luc Look, someone else abusing range-for loops!
2
A: Implementing Haskell's Maybe Monad in c++11

leftaroundaboutHere's my maybe "monad" that I use quite often in my C++ projects (disclaimer: see the comments below). It's insofar more like the Haskell Maybe than your implementation as it only holds an object in the just case (points mobj on it), not wasting space if it's nothing. This also allows it to use ...

 
@RMartinhoFernandes Yeah I noticed that.
 
3:39 PM
@sbi oooh, it's nice to have a proper scone
these heathen Irish have no idea about clotted cream
 
@thecoshman Irish? Heathen? That’s the first time anybody ever heard that!
 
0
Q: How to read ping information using c/c++/java

arbakWhen I ping using cmd, there are many lines for example: Reply from 209.85.175.138: bytes=32 time=34ms TTL=53 I want to read the time. How to read it or write the information from ping to a file?

I think this guy is confused.
 
@KonradRudolph what do you mean?
 
@thecoshman Aren’t the Irish in general more Catholic than the pope? Unless they’re not, in which they are as fundamentalist as Born-Again Christians from Carolina.
 
@EtiennedeMartel My policy is: "uses too many language tags, gets none"
 
3:43 PM
Either way, devout … not heathen
 
@KonradRudolph Devouts of other religions are heathens, no?
 
@RMartinhoFernandes Good point.
 
@RMartinhoFernandes I still wouldn’t dare call an Irish a heathen to his face ;)
 
don't know about clotted cream = heathen
 
@thecoshman But they know everything about potatoes
 
3:45 PM
@KonradRudolph ¬_¬ why not?
 
which reminds me …: how many potatoes does it take to kill an Irish?
 
Hm, potatoes, vegetable of the Gods
 
@thecoshman Quick to bomb you.
 
But, what's with all this racism here?
 
Stereotyping, much?
 
3:46 PM
@KonradRudolph raw potatoes are toxic, so I'd say about ten of them.
 
@EtiennedeMartel What? Me, a German? Racist? What are you implying?
 
@KonradRudolph oh yes, I forgot that all Irish, Muslims, Germans, Americans... just want to blew you up and kill you
 
@thecoshman The rest just the same, but they fail all the time are too busy going bankrupt
 
@sehe huh?
 
3:47 PM
@KonradRudolph Well, well.
 
@sehe Man, I was going to make that joke.
 
High level abstractions. Real C++ lounge
 
@daknok_t Nice answer, but no. The correct answer is “none”
 
Something like, "We don't have money to blow things up."
That typo was embarassing.
 
@RMartinhoFernandes lol
 
3:48 PM
to be fair, as some one who is fully immersed in Irish life, they do love there potatoes
 
I understand them. Potatoes are delicious.
 
@RMartinhoFernandes Made me look at the edit history just to see. It was ok :) Agree it looks silly
 
When you guys say potatoes, you mean "potatoes" or "potatoes"?
 
@RMartinhoFernandes ¬_¬
 
@RMartinhoFernandes oh noes
 
3:50 PM
tomatoes tomatoes
 
@RMartinhoFernandes "patate".
 
@EtiennedeMartel Nice save.
 
@EtiennedeMartel cold mash in the morning?
 
@EtiennedeMartel Unless fried.
 
honestly, every lunch time there are always at least three types of potato on offer
THREE!!!
 
3:51 PM
@RMartinhoFernandes Wut.
 
@RMartinhoFernandes I feel the opposite. They don’t really taste much of anything, unless carefully browned in a sprinkle of olive oil
 
Ugh, French fries are not delicious.
 
See, I was right, Henry Higgins (couldn't find my own My Fair Lady reference on the interwebs)
@RMartinhoFernandes Oh they are. You must be confusing the surrogates they serve at McD, BK, KFC and such - that's not french fries. That's 'mill' (?) stamped into french-frie shapes
 
@sehe No, I'm not confusing.
 
Actually, McDonalds fries are more like sticks of salt. With salt. And some more salt.
 
3:54 PM
huh... without Googling, would any of you know what an FDN is?
 
With a side order of salt.
 
posted on March 14, 2012

I am beginning to believe that swapping is as fundamental an operation as copying, and that it may even be more fundamental than assignment.

 
@EtiennedeMartel true enough. And the sauce is definitely made extra spicy so people won't use too large quantities of them
 
@thecoshman I'm out Googling as we speak.
 
@RMartinhoFernandes cheat
oh wait... I see what you did there
happy now ¬_¬
 
3:55 PM
absolutely
not
 
I don't like people that change the rules midway. Btw, now I know what it is without googling.
 
@sehe @sehe how do you responds like that
@RMartinhoFernandes it was a clarification
 
@thecoshman @thecoshman @thecoshman @thecoshman @thecoshman by typing. Usually using an USB attached HID device with standard internal 102-key layout. Why?
@RMartinhoFernandes He should have asked: "without ever having used google" :)
 
@sehe That would severely limit the target audience.
 
@sehe I mean, without having it say @Thecoshman for example... on side note, not sure how I managed to double @ you :P
 

« first day (515 days earlier)      last day (4440 days later) »