« first day (370 days earlier)      last day (4561 days later) » 

12:22 AM
My first git push!
 
@RMartinhoFernandes You're very good at explaining things.
 
Oh thanks.
 
1:10 AM
I should learn B and F# or Fortran. Then I'll know B, C(++), D and F(#).
E as well.
Plus, it'd just be cool to know B.
Er, on second thought, F#'s syntax is pretty grotesque...
(* Print a list of numbers recursively *)
let rec printList lst =
    match lst with
    | [] -> ()
    | h :: t ->
        printf "%d\n" h
        printList t
> The other sort of algebraic data type mentioned, "discriminated unions" (type-safe versions of C unions), can be defined to hold a value of any of a pre-defined type.
How are C unions not type-safe?
 
cpx
hm, I doubt there must be an 'A' too.
 
1:25 AM
Someone ought to get on that.
 
@Maxpm You easily get UB, not so with discriminated unions.
@Maxpm That's syntax based on ML and very much par for the course.
 
cpx
The aim of this list of programming languages is to include all notable programming languages in existence, both those in current use and historical ones, in alphabetical order, except for dialects of BASIC and esoteric programming languages. :Note: Dialects of BASIC have been moved to the separate List of BASIC dialects. :Note: This page does not list esoteric programming languages. A * A# .NET * A# (Axiom) * A-0 System * A+ * A++ * ABAP * ABC * ABC ALGOL * Abel * ABLE * ABSET * ABSYS * Abundance * ACC * Accent * Ace DASL * ACT-III * Action! * ActionScript * Ada * Adenine * Agda...
 
@LucDanton Do you have an example? I rarely (never?) use unions.
 
@Maxpm union { int i; double d; } u { 42 }; return u.d;
 
@cpx I like how dialects of BASIC have a separate list.
@LucDanton What would you expect that to return in a type-safe union?
 
1:30 AM
If the syntax was at all possible, an error.
However in a language like F# you need to use pattern matching to 'unpack' the value of an ADT.
 
@LucDanton You lost me.
 
(If the pattern matching is not exhaustive you do get runtime errors though, but that's not specific to discriminated unions.)
@Maxpm The language doesn't allow you to nilly-willy read any value out of an ADT.
 
Seems like a bit of a contrived limitation, no?
 
Why? Pattern matching is a common tool in those languages that use ADTs.
And more to the point: there's no limitation here.
Everything you can do in those language with a union-like ADT you can do in C or C++ with a discriminated union.
Except, of course, get UB.
So it's neither contrived nor a limitation.
Just to make sure we're on the same page: I'm using ADT to mean algebraic data types here, not abstract data types.
 
@LucDanton Oh. Yeah, I thought you meant abstract types.
 
1:41 AM
Sorry! I actually think it's not common to use ADT to mean algebraic. It's something my teachers used though. I'll try to shake off the habit.
 
pico screwed up my terminal.
o_O
@LucDanton No problem. I didn't know either definition; I just Googled it.
 
Right. The part where algebraic data types are union-like is when you use... unions of types :)
> In the last post we delved into some notation for algebraic data types (ADTs).
Looks like some people do use the initialism.
 
cpx
2:12 AM
is it undefined to cast a pointer to n number of pointer to pointers?
e.g `int x(0);` `int ***p = (int***)&x;`
 
It's probably implementation defined to make the cast, and I wouldn't trust dereferencing that pointer.
 
cpx
dereferencing fails the initial value.
 
What does that mean?
 
cpx
its returns garbage :/
 
Garbage in, garbage out.
 
cpx
2:19 AM
so basically, the value 0 is interpreted as an address. it doesn't matter how many pointers you use.
 
Hey @LucDanton What is this makefil doing? I need to write one but tutorials seems to be scarce. Specifically why is Hello used for so many diffferent things
@cpx
 
 
2 hours later…
4:15 AM
Try as I might, I can't make sense of how Terminal.app passes stuff like ^n to programs. For lowercase letters, it's just 1-26, but then ^i overlaps with Tab...
 
4:26 AM
^I is Tab.
[[Image:ASCII Code Chart.svg|thumb|right|upright=1.6|alt=All 128 ASCII characters including non-printable characters.|All 128 ASCII characters including non-printable characters (represented by their abbreviations). The 95 ASCII graphic characters are numbered from 0x20 to 0x7E (32 to 126 decimal). The space character is considered a non-printing graphic.]] The American Standard Code for Information Interchange (ASCII, ) is a character-encoding scheme based on the ordering of the English alphabet. ASCII codes represent text in computers, communications equipment, and other devices that u...
 
4:46 AM
Hi everyone, just a quickie: Why would 'while(!Example(Ex));' keep looping even when Example returns false?
 
Because the logic is inverted, so it'll loop because false is returned.
 
Oh, just found i mistyped that @LucDanton, but the problem is it keeps looping no matter what. :/
 
Sounds like UB.
 
UB?
 
Undefined behaviour. I'm assuming you're using a language that can have that.
 
4:55 AM
I am using Visual Studio 2010 configured for no charset
 
That's not a language.
 
In other words, plain C++ with no MS extensions
 
Well UB is a definite possibility then.
 
So i guess i should modify that sentence?
 
I'm not sure which one, but probably not.
 
4:59 AM
That is not supposed to happen, doesnt while check for the condition to be true at all times?
 
It's not supposed to happen for a valid program, yes. But if you have UB, then you don't have a valid program.
 
Why wouldnt it be valid? Can you please take a quick look at the snippet?
 
@Drknezz A program that exhibits UB falls outside of the scope of the C++ Standard and no guarantees can be made about its behaviour.
So I can't claim that while(foo()); will loop as long as foo() returns true in all situations. That only holds for valid programs, which mustn't exhibit UB.
 
Basically, Ex is a char*, initialized with malloc(), and Example returns wether whatever is read from stdin matches one of two strings
 
So from your snippet alone I can't say much more than that.
 
5:04 AM
@LucDanton
 
First off, you can't compare char*s like that.
 
That function will always return false, and thus the loop will never stop.
 
It will never return true.
 
But i assigned the return value to a temp bool once and it did work... somehow
 
Is there a reason you're not using std::string?
 
5:06 AM
It did compare like i expected it
 
@Drknezz As they say on the Internet, "code or it didn't happen".
 
@RMartinhoFernandes scanf() does not work with strings
 
Is there a reason you're not using std::cin?
 
@RMartinhoFernandes
I need performance, i read somewhere cin is very slow
Compared to scanf, that is
 
I read somewhere that the Earth is flat.
 
5:08 AM
Sigh.
 
@Drknezz "Premature optimization is the root of all evil."
 
It doesn't matter if it is slow.
 
@Maxpm Will have that in mind
 
Avoid problems like this by using the most readable and foolproof solution. That is, cin and string.
 
The only thing that matters is if it is fast enough.
 
5:09 AM
Quite frankly, you don't know how comparison works for string literals. You don't need performance, you need to learn the language. I'm not saying that to put you down, but look at where you're at: what kind of performance do you expect from programs that don't even do what you want?
 
You guys are all right, i think i overdid the quest for performance
I will fallback to more foolproof solutions
Thanks and sorry for wasting your time
 
If we didn't have time to waste we wouldn't be here :)
 
What he said.
 
@Drknezz You're not wasting our time. We're on Stack Overflow, anyway.
 
Lol
It is a simple huffman implementation anyways, not a SPOJ/ACM/... problem after all, i will take it a bit easier this time. Again, thanks for your time guys.
 
5:17 AM
Arrgh, I wish std::tuple_element was defined for std::tuple<>.
 
Perhaps specializing is fine?
 
You can do that?
(I mean, I know GCC won't complain, but does the language allow it?)
 
Why using 'std::tuple' over 'std::pair'? Im a bit noobish to the Cpp world and want some tips
 
std::tuple is not limited to two elements.
 
I think it's one of those customization points. Sounds a bit shady when there's no user defined type at all in the specialization, but I'm curious.
 
5:19 AM
Then a vector would of be fine as well
Wouldnt it?
 
A vector needs all elements of the same type.
 
Oh
 
You can have std::tuple<int, std::string, bool>.
 
I understand now
Pretty much like the python tuple [which i guess was in turn inspired by the cpp tuple]
 
The real inspiration is mathematical tuples for either.
 
5:22 AM
the three most useful keys , if using windows...
 
Thats a bit old, but still hilarious nonetheless
 
It's been a while since I had to press that for something other than login.
 
Here in the Middle East , metaphors are a bit different...
why did the camel cross the road?
 
Why did the road cross the camel's path?
 
Damn. @Luc you don't happen to have a ready made implementation of a boost.fusion adapter for std::tuple, do you? :)
This thing is killing me.
 
5:26 AM
I considered doing that but at some point I used conversions functions to and from boost::fusion::tuple/std::tuple instead.
I chucked it all in the bin as I haven't been using Boost.Fusion.
 
For some reason I have yet to decipher from within this mile long wall of compilation errors, this thing is trying to dereference the end iterator :(
 
Are you getting bitten by variadic pack + non-variadic templates bugs?
I guess not.
 
I don't think so.
I can expand stuff into boost::fusion::vector directly now. I guess I had the wrong compiler selected the other day.
 
I'm starting to use Valgrind more. It's amazing.
 
I find it a lot more useful/necessary when doing C.
Woohoo! It compiles!
 
5:42 AM
Push it!
 
Er, I'm not finished yet. I just finished the forward sequence requirements.
 
How much work is that? deref and next?
 
And size, empty, advance.
 
@IntermediateHacker that's not a camel (nor a dromedary), it's a turtle masquerading as a dromedary
 
Though those were easy.
 
5:46 AM
 
@StackedCrooked my late father used to ask that, although in his case it was "why did the hen cross the road?". he also asked, "what's the white in chicken shit?". the answers are, respectively, to get to the other side, and chicken shit.
 
Both are correct.
 
Hey! GCC 4.7 broke some of my other stuff :(
 
They don't call it the bleeding edge for nothing.
Or 'experimental support for C++11' actually.
 
What's the syntax for boost::fusion?
 
5:54 AM
C++?
Arrgh, my LRU cache tests don't even compile now.
 
at_c<0>(some_sequence);
 
^ This guy is an ordained Christian priest, and has been prime minister in Norway. So he can claim to be a minister in all respects. He was the first prime minister in Norway to take sick leave due to mental illness, and be open about it
 
What kind of mental illness?
 
Depression?
ADHD?
 
I think burn-out and depression, but it wasn't said
wikipedia says "depressive episode",
Kjell Magne Bondevik (; born 3 September 1947) is a Norwegian Lutheran minister and politician (Christian Democratic Party). He served as Prime Minister of Norway from 1997 to 2000, and from 2001 to 2005, making him Norway's longest serving non-Socialist Prime Minister since World War II. Currently, he is President of the Oslo Centre for Peace and Human Rights. On 31 October 2006 he published his memoir, called Et liv i spenning (A life of excitement and tension). Family and early life Bondevik was born in Molde, Norway. He became a theological candidate from MF Norwegian School of Theo...
however, in my humble opinion any person who believes that he or she is in daily or weekly telepathic communication with an invisible non-human being located in outer space or perhaps diffused everywhere, is not entirely rational. it's difficult to say this since so many suffer from such delusions (e.g. member of my family). i think it needs to be said, by as many as possible, to promote peace and prosperity worldwide.
 
user457812
That guy does not know how to make slides
 
user457812
Full paragraph on the first slide. O_o
 
maybe he's speaking to people who can read a full paragraph in less than half hour, yes?
 
Er, not fair. The docs for advance_c and advance do not match the implementation :(
 
user457812
6:13 AM
@AlfPSteinbach Maybe, but if it's a presentation, I would assume that particular slide isn't going to be up for long
 
Or I need sleep.
 
6:34 AM
@LucDanton Pushed :) hg.tumtumtree.me/wheels
Beware of bugs.
 
Seems silly to require to implement both advance and advance_c.
 
Also, distance reads "Return type: int", but the algorithms expect meta-ints.
 
sbi
I hope one day a waitress at a restaurant will ask me: Soup XOR Salad?
 
The sheer length of that code makes me glad I decided not to bother doing it. Hopefully 1.48 comes with support for std::tuple.
For your tests, maybe you want to check for &at_c<0>(t) == &get<0>(t) rather than just checking the value.
 
How frequent are boost releases?
 
6:47 AM
I think they adapt depending on whether there is something worth releasing. 1.48 is slated for next month IIRC. (That might be provisional however.)
 
With a prerelease/beta at the end of October.
It's hard to know what's in a release without following the mailing lists closely though. I have no idea of what's coming.
 
Argh, these docs suck. at_c is not stated as required, but it doesn't work off of at.
 
6:59 AM
Oh, MPL meta ints have a type typedef of themselves.
 
7:09 AM
D:\lib\boost\boost_1_47> b2 --build-type=complete gcc stage
boostcpp.jam: No such file or directory
Jamroot:138: in modules.load
rule boostcpp.set-version unknown in module Jamfile</D:/lib/boost/boost_1_47>.
D:/lib/boost/boost_1_47/tools/build/v2/build\project.jam:314: in load-jamfile
D:/lib/boost/boost_1_47/tools/build/v2/build\project.jam:62: in load
D:/lib/boost/boost_1_47/tools/build/v2/build\project.jam:168: in project.find
D:/lib/boost/boost_1_47/tools/build/v2\build-system.jam:570: in load
argh
there are only 60 000 files to search
i feel like maybe it needs a clean install again. i dislike the boost build spaghetti
 
Arrgh. The docs keep lying to me!
 
yes, they often do
don't do bleeding edge, that's the answer i think
 
user457812
It's called bleeding edge 'cause it's covered in the blood of those like you
 
it helped with boost to just replace all source files with fresh copy from archive
@nil if u want some bleeding edge i can give you then u can cut your tongue?
 
user457812
Can I just have some pictures of tasty food instead?
 
7:22 AM
Yes, pictures of tasty food would be nice =)
 
@nil no. i'm grumpy.
 
user457812
But I need my fix, man
 
^ These make a distinctive sound when you break them in two. Also quite tasty.
 
user457812
How odd
 
Good lord, amount of people that cry about executable sizes.
They're everywhere!
 
7:38 AM
I can't see them.
 
I see silly people.
 
It's very annoying that you can't get under 4 KB for a PE executable in Windows without wandering off into undocumented-land. Argh.
 
Yupee! Folds work!
 
^ Allegedly a typical "stereotypical computer set-up from the middle east"
 
Are these musical sausages typical in Norway?
 
7:50 AM
@Justin They're my preferred brand of wiener, if that's what you're asking.
 
Those holder thingies to put laptops on seem awfully convenient.
 
Oh, took me a while to notice the weaponry in the back.
 
@Alf Ok. I know of no sausage that can claim to have a distinctive sound in the US.
 
building boost optional generates lots of warnings about breaking g++ strict aliasing rules
that code may be a little unsafe...
 
I noticed as well when building Boost.
GCC does emit false positives for aliasing and Boost is under a lot of scrutiny, so that's something to hold on.
 
7:56 AM
yeah, I'd imagine it works fine in practice, but they ought to be able to get rid of those warnings
 
If that could be fixed just as Boost.Optional were made move-enabled, that would just be swell.
 
that said, boost.optional is something I haven't used for a long time because the benefit just seems too small. Usually easier IMO to either use a pointer, or hand-roll it as needed
 
Boost.Serialization generates quite a few warnings, too.
 
@jalf A pointer does not give value semantics though.
 
@RMartinhoFernandes that's why I said "or hand-roll it as needed" ;)
 
7:59 AM
hai
 

« first day (370 days earlier)      last day (4561 days later) »