« first day (447 days earlier)      last day (4505 days later) » 

9:10 AM
Hi
 
9:27 AM
"For example, I am yet to find a language other than AAL that works with floating point numbers like it should. I may be wrong, but research I’ve done shows AAL as being the ONLY language that supports bitwise operations on floating point number natively."
 
they always lose history
 
Why would anyone want to do bitwise operations on floating point?
If it's a bunch of bits, it's a bunch of bits, not a number.
No pun intended.
 
sbi
Because bitwise operations are sooo much faster!
 
9:29 AM
But what if you want to do Inf & NaN?
 
sbi
@Pubby Then that is sooo much faster, too!
 
@RMartinhoFernandes in c++ you need to do bitwise operations of fp values in order to reliably detect NaN
 
@AlfPSteinbach Can't you just rely on its observable behaviour?
Like x != x?
 
@RMartinhoFernandes no, doesn't work for g++ -fastmath
i thought my pic was nice. unusual, even.
 
9:33 AM
Well, whatever. What you want is isnan, not bitwise operations.
 
@RMartinhoFernandes you want bitwise operations in order to be able to define isnan portably
 
Make isnan part of the language and you fixed it.
No sane language needs bitwise on FP.
 
it is already part of the language
but in a way that conflicts with existing practice
they fucked up
 
What did they get wrong?
> The isnan macro determines whether its argument value is a NaN.
 
the macro is from posix
in c++ there is a function template
as i recall, of same name
 
9:37 AM
> The classification/comparison functions behave the same as the C macros with the corresponding names defined in 7.12.3, Classification macros, and 7.12.14, Comparison macros in the C Standard.
I quoted above from the C standard, and here from the C++ standard.
 
lemme try that
it seems to be there with g++, but not with visual c++ 10
 
I'm using C++11 and C99. I don't know how it was before.
 
however, _isnan( 3.14 ); compiles with both. it is of course non-standard
i think, if i had written the standard, i would address the issue of non-compliance and practical use by requiring some macro to be defined when std::isnan is present. that would allow source code level workarounds.
 
I think you might be able to rig something to test for that, but not at preprocessing time.
 
yes, you might do it in build system. and perhaps link in "the first" isnan function. but one can't write general library code that requires such elaborate build setup, i think.
then i think it's easier to just do the bitlevel thing instead of compiler and compiler version detect
anyway, in the sense of making life easier for those who want to test nan portably, c++11 is fail, at least for a few years
 
9:53 AM
I love shoe horning code into working ¬_¬
 
Why is it fail? VS11 implements all of the standard library, so I guess it includes isnan.
 
@RMartin was it you who revealed having freaky ears yesterday?
 
mine have got freakier... they seem to have changed size over night ¬_¬ head phones fit 'differently'
 
@RMartinhoFernandes it's fail because it leaves no apparent source level way to work around lack of std::isnan. and i doubt that msvc 11 got it. too much bother to check though
 
9:58 AM
@AlfPSteinbach Why would it need a way to work around something that is already in the language?
IMO it's the tools that fail.
 
@RMartinhoFernandes that sounds argumentative. it is meaningless
maybe you don't know that std::isnan was introduced with c++11
?
 
Anyway, here's a compile-time hack to test for its existence: ideone.com/9nDV8 / ideone.com/YWdTh
Wait, that's not working.
 
does that work nicely when the posix isnan macro is defined?
as i recall scott meyers has asked publicly many times for ways to detect availability of various features. in order to provide workaround for lack of feature. never got a good answer
 
@AlfPSteinbach Yes, that should pose no problem. There's something else going on.
 
Don't you just love the lowest common denominator
 
10:05 AM
@AlfPSteinbach Ah, now I see what you meant with the workaround bit. Yes, it would be nice if they did a bit more like the C committee.
Ok, now I'm intrigued. The function does exist on the ideone compiler: std::isnan works. But it doesn't work with using namespace std;.
It does work if I declare a bool isnan(float); function in the detail namespace. WTF is going on?
 
he he, i don't know
only know that it's problematic(tm)
 
It's no longer about isnan. Now it's personal.
What is the difference between bringing it to scope with using namespace and declaring a new one in scope?
 
guys
check this please
In computer science, a hash table or hash map is a data structure that uses a hash function to map identifying values, known as keys (e.g., a person's name), to their associated values (e.g., their telephone number). Thus, a hash table implements an associative array. The hash function is used to transform the key into the index (the hash) of an array element (the slot or bucket) where the corresponding value is to be sought. Ideally, the hash function should map each possible key to a unique slot index, but this ideal is rarely achievable in practice (unless the hash keys are fixed;...
In computer science, a hash table or hash map is a data structure that uses a hash function to map identifying values, known as keys (e.g., a person's name), to their associated values (e.g., their telephone number). Thus, a hash table implements an associative array. The hash function is used to transform the key into the index (the hash) of an array element (the slot or bucket) where the corresponding value is to be sought. Ideally, the hash function should map each possible key to a unique slot index, but this ideal is rarely achievable in practice (unless the hash keys are fixed;...
 
Why did you post the same link twice?
 
it isnt the same
click them
also check the Big O
 
10:19 AM
Woah.
They even have the same revision history.
They both have this edit: "Assuming most general case of unsorted linked list for each bucket, average search is cited in this article as O(1+n/k)"
 
yeah it's totally strange
 
Also, WTF, worst case of insertion O(1)?
 
0
Q: Weird Compiler Error in Parser Code.

IntermediateHackerParser.h enum { PLUS, MINUS, DIVIDE, MULTIPLY, NUMBER, END } type; int token; /* parsing functions */ void parse_token (void); Parser.c void parse_token (void) { if ( strchr ("1234567890.", token) ) type = NUMBER; else if ( strchr ("+", token) ) type = PLUS; el...

I hate C.
 
Read the compiler errors.
Check the lines.
I'm sure it will become obvious.
 
could it be that it's some caching-linking error?
 
10:26 AM
@bamboon Might be. But one of the two versions is terribly wrong.
It says search is worst case O(n), but insertion is O(1).
 
well bad, that it is in the most important part of the article
 
@IntermediateHacker have you #included the header?
 
what do you think the right version is?
 
@bamboon Neither?
:)
Insertions start by doing a search, and then placing the new value in the empty spot found. Compare the running times for insertions and for searches.
 
10:39 AM
hey guys
I woke up this morning and I noticed some major holes in my code
so feeling good
 
I waited over an hour to update server so I could run one command to find out the object returned from a function is not actually string ¬_¬ ffs
 
previously I knew it was bad but couldn't figure out why
and now I know
 
Wanna have look at my attempt at detecting if std::isnan exists and explain why it doesn't work?
 
why doesn't it work?
 
10:42 AM
It doesn't detect it when it should :)
Contrast with this one: ideone.com/Bi3mp
 
maybe it could be OK SO question?
 
I'm writing one :)
 
@IntermediateHacker No more C#?
 
0
Q: SFINAE to test a free function from another namespace

R. Martinho FernandesI was trying to come up with a hack to test if std::isnan is defined without special casing compilers in the preprocessor, and came up with this, which I was expecting to work fine. #include <cmath> #include <type_traits> namespace detail { using namespace std; struct dummy...

@AlfPSteinbach Finished.
 
11:01 AM
Well, how is std::isnan going to be picked up in that decltype? ADL can't apply.
 
@LucDanton It's in scope.
 
I don't see how.
 
using namespace std;?
 
are you sure that is valid?
I mean, the one with the bool isnan(float);
that it actually comes back with "no" when it doesn't exist?
 
Why wouldn't it?
 
11:11 AM
because I'd expect it to come back with "yes" all the time
 
Right, but if there's no bool isnan(float) in sight, it comes up with no.
If there is the one imported from using namespace it still says no. If I write one right there, it says yes.
Perhaps you're confused by ideone saying "success" (main returns 0) when the metafunction says "no"?
Damn, I was really stupid.
3
No, I wasn't.
 
If I am opening input streams in binary mode , is there any real difference between the stream for an avi file or a jpeg file ?
 
@Alf ha, now it works. ideone.com/o8Jcf
My declaration with the dummy thing was hiding the one from std.
 
@RMartinhoFernandes just to enhance my CV I'm gonna learn C#, Can you tell me any good book for c++ idiot users like me?
 
Jon Skeet's book is really good, but it assumes you already know at least the C# 1.0 part of the language. I can't recommend any starter book, because I never read one. I can not recommend Fluent C#: it's full of factual errors and people say it's in a visual style that is hard to read.
Eric Lippert recommends Essential C#.
 
11:24 AM
Jon Skeet has reviews of other books on his blog, you could read those
 
@Pubby link please? don't know Jon Skeet.
 
@RMartinhoFernandes starts from basics I guess :)
 
He says he likes Essential C# and C# in a Nutshell
 
@RMartinhoFernandes Thanks :)
@Pubby Thanks but I think both book requires you already know basics of C#
 
11:30 AM
@RMartinhoFernandes Hey Martinho , If I am opening input streams in binary mode , is there any real difference between the stream for an avi file or a jpeg file ?
 
@MrAnubis Eric says Essential C# is good for people coming from other languages.
@angryInsomniac No.
If you open it in binary mode, it's just a bunch of bytes.
Buying tech books online looks risky.
You can't have a look at it before you buy.
 
@RMartinhoFernandes I'll get the ebook I guess:)
 
@RMartinhoFernandes seems to work, if you wrap it with an #if !defined( isnan ). Hey, maybe should inform Scott Meyers ;-)
I think this is yet another example why one should include [math.h] and not [cmath]: writing unqualified isnan then works for both macro and function
 
As is it works for the macro as well.
I'm not qualifying it in the test.
 
no, not sure. i defined a macro above. then it didn't compile'
 
11:36 AM
Hmm.
 
like
#define isnan( x ) (2 == 1)
 
Ah, you're right, the macro would fuck up my dummy declaration.
Fuck macros.
 
yes :-)
 
But including math.h instead wouldn't help either. The macro version would still mess it up.
 
i mean, testing for macro is trivial, that's what the preprocessor is for, yes?
 
11:45 AM
Yeah.
A simple #if doesn't cause harm :)
 
ok, i determined from christmas gift of miniature bottle, that jägermeister tastes sort of like coughing syrup, but with a hint of alcohol
 
Wikipedia says that thing is 70-proof (35% abv).
 
What's the preferred way of getting a const_iterator?
 
11:53 AM
cbegin()/cend()?
 
Heh, didn't know those existed
 
They're new.
 
Does ranged-based for loop use them?
 
No :(
But I don't see it making a difference.
You don't get access to the iterators with the range-based loop anyway.
for(auto const& x : xs) should be enough.
 
@MrAnubis What.... He doesn't know Jon Skeet - Heresy!
 
12:08 PM
@sehe He likely knows his by his ancient name, Amun-Ra
 
@sehe I hope you'll not sue me for this :)
 
@MrAnubis I won't. But we won't need to. Denying the deities has a tendency to wreak itself. See greek dramata :)
 
This photo was taken by a carrier pidgeon in 1909.
 
The things you google up... Nothing to do?
 
@RMartinhoFernandes ... and?
 
12:18 PM
@RMartinhoFernandes must've been a robot if it could take pictures
 
Also, fuck, I misspelled pigeon again.
Dammit.
 
Go pidgeotto!
 
 
I love the 24 bit
 
Check
 
12:22 PM
Does it have all the characters so far?
 
@RMartinhoFernandes I was actually looking for the couple in promiscuous position, but I haven't found it yet
 
I can't find a single instance of the black hat guy!
 
Allthough this looks a bit like a cute little girl wielding powerful... tools:
Jan 1 at 14:52, by sbi
But, really, while C# is a neat little toy language, it feels like wielding a cute little girl where C++ feels like a fully-armed battle-hardened elite soldier. I miss the raw powers of C++ templates so badly.
 
Ha! Found him!
And btw, so far there are only 999 xkcd comics.
4
 
4
A: how much work is done by calling vector.size()?

AlsUse iterators instead of such a loop for more flexibility and genrosity: std::vector<int>::const_iterator iter = myVector.begin(); for(iter; iter!= myVector.end(); ++iter) { } This ensures that if you change your container at later stage of development you have less tightly coupled ...

> Use iterators instead of such a loop for more flexibility and genrosity
 
12:29 PM
 
@RMartinhoFernandes Ow. You should notify him, I think.
 
I'm sure Randall knows comic 404 doesn't exist.
That fact alone probably counts as a comic.
 
I'm sure he'll just point you at the 1000th replacing the missing 404 (302?)
 
403 is lols
 
12:32 PM
"My sexual Erdös number is 3!"
 
hi @rubenvb
 
There's a Waldo!
 
@rubenvb you committed to the A51 Mathematica proposal some time ago. Since then it was closed as "inactive", relaunched, and already reached 156 committers in less than a month. It'd help if you could commit to the new proposal again. Sorry for writing here, couldn't find you on freenode.
 
meh ^ seems like the most promiscuous one there. Something like this xkcd.com/400 would fit my search pattern
 
Ha! Found Waldo!
 
12:46 PM
5
Q: SFINAE to test a free function from another namespace

R. Martinho FernandesI was trying to come up with a hack to test if std::isnan is defined without special casing compilers in the preprocessor, and came up with the following, which I was expecting to work fine. #include <cmath> #include <type_traits> namespace detail { using namespace std; str...

^ Is the selection of a "solution" there really correct?
 
The answer is a bit confusing, but it does give out the explanation and a solution.
 
@RMartinhoFernandes I mean, you're pointing out in a comment that "I have using namespace because I can't name the function if I'm expecting it to not exist". That is in direct conflict with the answers first sentence.
 
Yes, it probably could do with some editing. I'm a bit tired to fix that.
That suggestion needs to go.
I think I fixed it now.
I don't remember ever seeing a skeleton on xkcd.
 

« first day (447 days earlier)      last day (4505 days later) »