« first day (570 days earlier)      last day (4379 days later) » 

11:00 PM
Woah, that question isn't yet closed?
Also, Boost is unlikely to get a GUI.
 
@CatPlusPlus I'm aware
@stdOrgnlDave very rarely
 
@MooingDuck i think, not sure, that also boost is missing a currency type. currently cannot express foreign debt of USA with built-in C++ types... that's a bit facepalm
 
@CheersandhthAlf it needs a fixedpoint class
 
currency type is so, so much more complex than you guys know
because you think currency is easily convertible
 
@stdOrgnlDave I doubt that. It's a simple integer with a 10^-2 bias.
 
11:02 PM
@MooingDuck template stuff?
 
@stdOrgnlDave Is that why .NET.Decimal is 128 bits?
 
and a bignum class
 
@CaptainGiraffe by 'currency type' I was assuming it was meant with the ability to convert between them.
 
@stdOrgnlDave No. The only way to implement that would be to query some website for exchange rates.
 
@stdOrgnlDave you assumed wrong
 
11:03 PM
@stdOrgnlDave Yes of course. There is no good conversion Decimal to double. Knuth would flip in his grave if he was dead.
 
exchange rates are just the very beginning of currency conversion, oh it is so complex.
exchange rates are very easy to express
 
@stdOrgnlDave Very hard to get hold of, though.
 
the only fair representation of currency is string.
 
@DeadMG well, let's say I had a price 10 days ago, and the data for the last 10 days. do you think I could get an accurate conversion?
 
@stdOrgnlDave: current usdebt is ~$15679929784524.06
 
11:05 PM
I do can share a few predefined constants for that. [0] == "greece"
 
@stdOrgnlDave You want to account for inflation over the last ten days?
 
@DeadMG not only inflation, but purchasing power, and about 20 other important metrics
 
@DeadMG exchange rate variation, not just inflation
 
what you can buy with $10 at the exchange rate 10 days ago is different from what you can buy with $10 today if the exchange rate is the same
it is so stupid :-(
assigning value to paper money is retarded
 
Depends on whether you actually need conversions accurate with respect to date.
 
11:07 PM
Oh, Berta. Oh Berta. Every Sunday dollar in your hand.
 
I wouldn't.
 
@CatPlusPlus really? you'd only show money in real-time?
 
If I ever convert currencies I only care about present state.
 
> When a professional race car driver races, his pulse gets lower and he relaxes. When I code it is the same thing. -Jun-ichiro Hagino
 
11:08 PM
indeed, that's good for you. but the Boost guys do it right. they abstract the shit out of stuff and make it hard to use. have you seen the frickin time libraries? they've got everything abstracted so much it takes an hour to figure out how to get a POSIX timestamp out of it
 
Also, Boost already has BigInt library accepted, I think. Or maybe it's still in review, but it's probably going to be accepted anyway.
 
@TonyTheLion Counterexample would be the snooker grand Steve Davies
 
Yeah, dates have their quirks, too.
 
BigNum isn't really good enough for finances, either. for instance, it's very helpful to be able to represent e symbolically until you actually need to resolve it
 
@CatPlusPlus in review last I heard
 
11:09 PM
Calendars, timezones, everything that's boring and silly.
 
@CaptainGiraffe donno who that is
 
And exotic stuff like leap seconds. Who the hell needs that.
 
I got that quote from here
 
btw are there any measures for us not obliterating in 2038?
 
@stdOrgnlDave so use a different library for that. I just want a bignum type.
 
11:10 PM
bigint != bignum
 
Oh, our time is inaccurate because it differs by a second from sun!
Unacceptable!
 
@CatPlusPlus that's my point! Boost currency would be ridiculous!!!
 
@stdOrgnlDave I want both. A math library that uses symbols is completely unrelated to bignum/bigint in every way
 
@TonyTheLion World champ snooker player, had a pulse meter on him during a high stakes poker game, it never left the 65-70 range.
 
11:11 PM
@CaptainGiraffe a snooker player playing a poker game?
 
That Boost library is bignum.
 
@MooingDuck yep, Steve Davies nonetheless
 
@MooingDuck With a snooker face.
 
here is code to get POSIX timestamp (in microseconds) from Boost
> boost::posix_time::time_duration time_from_epoch = boost::posix_time::microsec_clock::universal_time() - boost::posix_time::ptime(boost::gregorian::date(1970,1,1)); return time_from_epoch.ticks();
 
fucktittyshitballs, it's cold
 
11:15 PM
there, I just saved you two hours of staring at documentation uncomprehendingly to try to get a POSIX timestamp
 
using boost::posix_time;
using boost::gregorian;
return (microsec_clock::universal_time() - ptime(date(1970,1,1))).ticks();
@stdOrgnlDave also, now that I simplified it, I'm pretty sure that's not the "right" way.
 
what's the "right" way then?
and by the way, your simplification is fail
but anyhow
 
@stdOrgnlDave how is it fail? Always possible I messed something up
 
I don't think the compiler will deduce that you're trying to get a time_duration out of that, and construct it, and return ticks() of it
I could be wrong
 
Why not?
 
11:17 PM
@stdOrgnlDave oh, did a conversion happen? I couldn't see that.
 
but the time library is stupidly complicated
 
What would operator- return?
 
@stdOrgnlDave now that I look again, it should work fine
 
let's sidestep that - what is the "right" way?
 
time_duration operator-(ptime)
 
11:19 PM
@stdOrgnlDave I think theres a better way to get the epoch at least, I'm checking the docs
 
@MooingDuck I stored the epoch structure myself, I just globbed all the code together to show you what you gotta do to get it
 
Wrap in get_timestamp(ptime), forget.
 
if you want to print a string from that timestamp, get ready for a whole other bag of worms :-(
you gotta construct a time_duration from 0, then use that to construct a ptime from that duration from the epoch
I understand that someone somewhere probably thinks it's very intuitive
 
Or doesn't like POSIX timestamps, because really, who does.
 
me
 
11:26 PM
POSIX timestamps are very, very handy when you need to timestamp stuff
 
Save for some interop stuff, you can just use ptime directly.
 
using 64 bits, even with microsecond accuracy, I had a few bits left over for flags, of course, for different epochs etc.
"use ptime directly"?
are you saying there's a ptime() function in Boost and I missed it?
 
ptime is that type.
 
I use a float to represent time.
 
11:28 PM
Okay, C++ y u undefined reference.
 
@CatPlusPlus it's true that you can in fact do that, but the point here was to get a timestamp
thoiugh usually if you try to use ptime you'll be stuck fighting a time_duration and boost::gregorian's strangely one-way constructors
 
namespace x { extern const unsigned foo; } // foo.hpp
namespace x { const unsigned foo = 42;   } // foo.cpp
// this should work, right?
 
@CatPlusPlus yes, but there's no point to it.
 
It doesn't?
 
@CatPlusPlus sure, but you can't use it as a compile time constant outsid ethe file
 
11:30 PM
It doesnt'.
 
@stdOrgnlDave sure there is, I need to do that all the time
 
I'm pretty sure LTCG would manage to inline it.
 
@MooingDuck why should not the const simply be directly in the header? each object will contain its own local copy. of the const
 
But optimisations later. Now it should work.
 
@CatPlusPlus I don't think it's legal if you re-declare the extern version in foo.cpp.
but extern is one of those things that I have never, ever, used, so
 
11:31 PM
@DeadMG First is a declaration, second is a definition.
 
oh, yes, catplusplus, you must use an extern guard
 
@stdOrgnlDave oh, I missed the const. In that case it usually goes in teh header
 
Nothing's redeclared.
 
namespace x { extern const unsigned foo = 42; }
 
#define extern_owner #include header.h
 
11:31 PM
Can't do that?
 
that kind of thing
 
If I wanted to recompile entire project every time it changes, I would have left it as #define, eh.
 
@CatPlusPlus makes sense
 
@CatPlusPlus If you #include "foo.h" from foo.cpp, then you just declared an extern foo, which the compiler might look for in another TU.
 
thats what an extern guard is for
 
11:32 PM
eh, I don't know WTF I'm talking about
bother the robot for it tomorrow, he'll know
 
#ifndef extern_owner namespace x { extern const unsigned foo; } #endif
 
Well this sucks.
 
No, wait, that TU doesn't even include that header.
 
it's annoying as heck
is foo typedef'd the same?
oh
 
11:34 PM
Ha, now it works.
 
wait, why is it just 'unsigned'
 
Without that guard thingy.
Because it's unsigned, duh.
 
@stdOrgnlDave Implies unsigned int.
 
unsigned is so much more convenient than unsigned int
 
ah. I am always much more explicit about my numbering, never ever used simply unsigned
uint32, uint64 etc.
 
11:35 PM
I don't care for exact size.
 
I do!
 
@CatPlusPlus auto? :P
 
and I'm glad I do! my low-level code ports perfectly from 32-bit to 64-bit compiles!
 
@stdOrgnlDave Ironically, I had a conversion problem the other way around.
 
It doesn't make a difference if this thing is 32 or 64 bit.
 
11:36 PM
@DeadMG oh?
@CatPlusPlus are you sure? what about integer promotion? HMMM?
 
@stdOrgnlDave Yes, I'm sure.
 
@CatPlusPlus j/k
 
@stdOrgnlDave really? that's rare when you declare it specifically like that.
 
@MooingDuck when I declare what specifically like what?
 
@stdOrgnlDave uint32
 
11:37 PM
Now, why doesn't it see Boost.
 
that's my own typedef
 
@stdOrgnlDave irrelevant
 
yes i know there's a uint32_t but screw that
I actually declare about 95% of my number variables that way
 
It was compiled with -std=c++0x so wtf.
 
@CatPlusPlus why can no haz boost
 
11:39 PM
Did I mention how much I hate C++ tools?
Oh, build system didn't even put libs in command line.
Gah.
 
but then my recent projects have all involved both low-level code and cross-compilation for 32- and 64-bit targets, so it kind of pays to be explicit
well, all of my recent projects except the ones where I murder compilers for fun
 
ok
i think the code just got bigger?
is more clear now or less clear now?
 
and, yeah, they also target multiple architectures and platforms
...
anyhow
bai
 
Two Nice Answers in one day yeahhhhhh
 
i wonder, for using for_each in the display function, is there easy clear way to detect first iteration?
 
11:45 PM
@CheersandhthAlf pure and grey look the same to me
 
Xeo
@thecoshman: Next episode is out
 
@CheersandhthAlf do the first, do the rest. Just have to check for passing in 0
@CheersandhthAlf not to my knowledge no
oh, I found the difference between pure and grey
 
@MooingDuck hm. then ordinary for seems more clean for that...
 
@CheersandhthAlf wait, lemme think, I think ostream_iterator has magic for that...
the demo code is almost exactly what you need
off I go, night all
 
@MooingDuck not sure how to detect first (or rather, !first) iteration, except by using an external flag?
 
11:53 PM
classes and structs are really only in existence for the programmer to be able to "specify" things that belong together. Is there any guarantee that members in a class or struct will be layed out contiguous in memory? The code executing on the machine doesn't really have any notion of class or struct does it?
 
@TonyTheLion nope it doesn't, but structs are guaranteed to be laid out in contiguous memory except for padding
 
access to a class foo and it's member x when compiled to machine code, is just the same access as it would be to x directly, or am I wrong?
 
That's correct
 
ah ok
 
 void display( vector<wstring> const& patterns )
{
    copy(begin(patterns), end(patterns), ostream_iterator<wstring>(cout, ' '));
    cout << endl;
}
 
11:55 PM
@TonyTheLion the machine just sees reams of bits, it's your job to make meaning of them
and the compiler helps by doing offsets and stuff with member accesses
 
now things that the compiler does, like create template instantiations, they are not executed by the compiler? Or decltype is just interpreted by the compiler as "give this expression a type", but nothing more?
 
What?
 
@CheersandhthAlf did you see that code?
 
yep, but doesn't add a space after last item?
 
decltype just asks the compiler to give the type of an expression without actually executing the expression
 
11:56 PM
@TonyTheLion things in decltype and sizeof are not put into the code, they just give a type
@CheersandhthAlf I'm pretty sure it doesn't
 
@SethCarnegie ok, let me rephrase that, template instantiations, are done by the compiler right?
 
@TonyTheLion what do you mean "done"?
 
but if the template instantiation has a call to foo(), that foo() is not executed by the compiler?
 
@TonyTheLion instantiations of template functions create executable code
 
11:58 PM
@TonyTheLion they are "templates", factories from which to make other functions
 
@TonyTheLion can you give an example of what you mean? Where is foo?
 
@MooingDuck I meant the compiler creates template instantiations
 
Yes, for a very loose definition of "create"
 
@TonyTheLion If I understand you, then yes
 
template<typename T> struct f { void foo() { /*do whatever*/ } }; f<int>.foo(); <--- this call on f<int> is not executed by the compiler, just interpreted
 

« first day (570 days earlier)      last day (4379 days later) »