« first day (591 days earlier)      last day (4371 days later) » 

1:03 PM
I wish there were some unicorns around to kill
@RMartinhoFernandes was it you who was asking if std::array<int,10> a; was required to take the same space as int a[10]; ?
 
@stdOrgnlDave Unicorns are cool. Don't you dare kill any of them.
 
@EtiennedeMartel I'd like to try my hand at bowhunting but don't want to hurt real animals :-(
 
@stdOrgnlDave erm... targets?
 
or people
 
Robot targets
 
1:09 PM
@jalf I was going down the legal route, but what ever
 
I think the following is just too "clever" in the negative sense, and not providing enough of either source code savings or improved efficiency; do you folks agree?
bool isWeekday( int const x ) { return (x < 7u); }
 
@Pubby Yeah. Let's shoot at robots.
 
@stdOrgnlDave it was @FredOverflow, I think
 
@CheersandhthAlf Warning: signed and unsigned compare.
 
@CheersandhthAlf isWeekday(-92947473) == true
 
1:14 PM
@Neil is it?
 
I see what you did there. ;)
Though perhaps that is a bit too clever as you say.
 
@CatPlusPlus that's part of the "clever"-ness, implicit instead of explicit just to save some typing and reading.
 
What cleverness? It'll still raise a warning.
 
@CatPlusPlus expressed in explicit fashion you will get no warning with current compilers
 
> int random() { return 4; /* this number was randomly chosen by dice roll */ }
2
 
1:17 PM
IMHO, handling calendar operations yourself is not cleverness.
 
@CheersandhthAlf either way, it's a badly named function. weekday is often used to mean Monday to Friday, specifically excluding the weekend
 
use boost to handle all calendar calculations. even though I hate it it's very helpful.
 
@thecoshman How else would you name that method though?
isDayOfWeek I suppose.
 
is_weekday_but_not_that_weekday_that_other_weekday_which_doesnt_mean_monday_to_f‌​riday.
2
 
@Neil isLessThanSeven :)
 
1:20 PM
I vote for @jalf's answer
 
@CatPlusPlus damn you! More and more I'm proffering that style of 'names'
 
although it assumes that the week starts at 0
 
What happens when the apocalypse comes and we redo our calendars to have 11 days in the week?
It's *hard coded*!
 
star this message if you like variable_names_like_this
star this message if you like VariableNamesLikeThis
 
although it should really be templated, so you could also reuse it to test if something is less than six
 
1:21 PM
@stdOrgnlDave Where's the downvote button?
 
Star this message if you suck.
7
 
@Neil is_day_of_the_week_of_varaiable_length(int day, int weekLength = 7);
 
isLessThan<7>
 
@CatPlusPlus Sluuurp.
 
@thecoshman brilliant_i_love_it
 
1:21 PM
I think @coshman is right, according to simple wikipedia
 
@CheersandhthAlf about weekdays being Mon to Fri?
 
yay! I like being right
 
so, isDayOfWeek
 
@jalf template<unsigned long long T> bool isLessThan(unsigned long long x) { return x < T; }
 
1:23 PM
boo?
oh shit
 
I need to hide using boo = bool; somewhere in my code from now on.
 
hehe
typedef bool logic_biatch;
 
@CatPlusPlus 'using' is the same as 'typedef', though I suspect there is more to it then that
 
It's better.
It can do templates.
 
1:26 PM
using logical_shit = bool;
using you_bet_your_sweet_ass = true;
using oh_hell_no = false;
 
Types, not values.
 
@CatPlusPlus don't make me #define your ass!
 
typedef bool logical_variable; typedef unsigned long long integral_variable; template<integral_variable T> logical_variable isLessThan(integral_variable x) { return x < T; } const logic_variable boolean_value = isLessThan<7>(4);
 
I think C++ has reached a critical mass of things you can arse around with. The next version will add a few more things, and push it over the edge, resulting in nothing ever getting produced for people attempting yet more obtuse ways of writing simple things
 
Modules.
 
1:31 PM
@thecoshman don't let the puppy hear you say that
 
I want modules. I don't give a shit about anything else.
 
are modules webscale
 
@dead have a look up at my last post
 
what about it?
 
so why are C99 variable length arrays evil?
 
1:32 PM
@DeadMG any fucks given about what I said?
 
@stdOrgnlDave the would be evil in C++ because they mess up the sizeof operator
 
@CheersandhthAlf C has a sizeof() also
 
@thecoshman Not really. I don't think C++ can become significantly better either, but I've held that opinion for a long time.
 
yes, but in C it's not so critical that it's compile time only, and due to VLAs it isn't in C99
in C++ sizeof is guaranteed compile time
that's what "mess up" meant
 
@CheersandhthAlf That one proposal for VLAs in C++0x2 didn't allow that silly sizeof at runtime nonsense
 
1:34 PM
@DeadMG didn't think you would care :P
@Pubby C++0x2? wtf you smoking?
 
@CheersandhthAlf thank you I was wondering why Bjarne hated them
 
@Pubby i don't know of any proposal. i have seen and participated in some discussions though
 
@thecoshman C++1x if you're optimistic
 
it could be done properly in C++
 
C++0X2TR2verAlfab2.1
 
currently alloca is the de facto standard, but it's unsafe and its error handling differs across compilers
 
@ScarletAmaranth

Microsoft Visual C++

FTFY
 
you can allocate off the heap faster than alloca anyway
 
@stdOrgnlDave Youve just "plinged" me like 8 times with all those edits ... RAWR ...
 
Damnit, I was writing "inb4 deadmg mentions that"
 
1:37 PM
@ScarletAmaranth oh, didn't know it did that, sorry.
 
@ScarletAmaranth turn of the plinking noise
 
@DeadMG i don't think so. we're talking one instruction here.
 
stop that :D
 
actually, you're not
 
@DeadMG can you provide a case that is true? my testing has shown that alloca() is generally faster. not that you'd ever use a C function.
 
1:37 PM
Mussolini is desperate to join winning side. Ciano- Italy's Foreign Minister- to French: "Win a few victories, & you'll have us as allies."
 
there's a bunch of stack checking and alignment and things in there
even in release mode
 
It's not off the heap, it's off a custom allocator (that exists on the heap)
 
some times, I forget what this feed is all about, and I get worried
 
@DeadMG not really. The stack maintains some fairly alignment invariants
 
@Pubby Which allocates off the heap.
 
1:38 PM
it's not hard to push data onto the stack
 
well, I don't pretend to have implemented alloca
 
Yeah, I dunno why it alloca would be slower
 
@DeadMG for what compiler?
 
all I know is that I wrote one which performed faster under MSVC10 in release mode
 
I remember someone did benchmarks in here a while ago and alloca() was like, 10 times faster
 
1:39 PM
0
Q: C++: Patterns: which pattern is good for specific code execution depending on command line arguments

DaddyMHaving C++ console utility. The code inside parses the command line input and depending on input invokes particular function. I've got a big ugly parsing routine that calls global functions. I dislike this code and want to organize this code by design pattern application. The flow is as follow...

Pattern shoppin' season.
 
@stdOrgnlDave Because the "te" in allocate slows it down. It's true!
 
@CatPlusPlus <insert stupid comment about patterns being the anti christ>
 
The only pattern that should ever be used are the Singletons, duh.
 
is hilarious.
> What pattern should I use to express a Hierarchical Enum?
> State pattern vs ENUM
 
Enum pattern!
 
1:42 PM
Lol, there's .
 
@ScarletAmaranth Obviously. Singletons with a private constructor and getInstance method. Otherwise people could actually use them.
 
I didn't think anyone used this crap.
 
enum is the stupidest worstest thing ever. namespace/static const int FTW. except they were fixed some with C++11 but not fully.
 
Oz is crap?
 
Yes. Yes it is.
 
1:43 PM
Elaborate!
 
@Neil you forgot a SingletonFactory that calls the getInstance method
 
I don't think patterns mean what I think those people think it means
 
@stdOrgnlDave Right, I forgot about that. SingletonFactory which uses the Acceptor/Visitor pattern of course.
 
@stdOrgnlDave What? static const int requires silly numbers
 
It has weird syntax and tries to be too multiparadigm for its own good.
 
1:44 PM
Sounds like C++ to me
 
Also Mozart requires emacs.
 
@Pubby yes but it also doesn't pollute the namespace you put enum in, thus almost defeating the point of said enum. they only give you type safety but it's stupid and broken.
 
enum class doesn't 'pollute' the namespace.
 
hmm. perhaps.
off to find furniture purchase receipt, will be back
 
How does static int not 'pollute' the namespace? They do the same thing.
 
1:45 PM
data E = A | B | C deriving (Enum) FTW, anyway.
Who needs silly numbers.
 
Can that do this?
enum my_enum : decltype(their_enum) {
  my_value = their_value
};
(dunno if the syntax is correct)
 
What for?
 
You want to alias the enum?
 
Alias parts of another enum for convenience
 
I'm sooo good.
 
1:49 PM
For what convenience?
 
I did something like this a while back:
enum image_color : decltype(GL_RGB) {
  rgb = GL_RGB,
  bgr = GL_BGR
}
And then I could replace a switch statement with a cast (my image code used GL internally)
 
bool is_rgb = color == GL_RGB;
 
What?
 
What do you need that enum for?
 
@Pubby Cat means to say, is it interchangeable?
 
1:51 PM
Cat the cat.
 
OMFG A GIRL IS HERE EVERYONE ACT COOL
2
 
I mean to say it's unnecessary overkill.
 
(And if source integer is not GL_RGB or GL_BGR then the cast invokes UB.)
 
@CatPlusPlus I agree. Seems like unnecessary complexity.
 
1:53 PM
@CatPlusPlus That's what the decltype is for (if I understand what you're saying)
 
@stdOrgnlDave You're late to the party.
@Pubby That specifies underlying type, but valid enum values are only those defined in the body.
 
Well what other values would there be?
 
I don't know. But if there are only ever two, then what do you need an enum for? Use is_rgb = color == GL_RGB;
Either way it's silly.
 
But the idea is that you don't use GL_RGB
Well the client doesn't use it
GL is all internal stuff
 
And that buys you what, exactly?
You expose it in the header anyway.
 
1:55 PM
Well not in the interface
Anyway
 
I bought peaches with syrup. Cause peaches with syrup be da shet. Yes sir.
 
@Pubby GL is unfortunately not internal stuff (otherwise I doubt they'd call it **open**GL)
 
They call it OpenGL for the fun
Only the spec is open
Rest is not
How misleading
 
@Cicada Yeah, can't spell fun without GL.
 
@Cicada What kind of syrup?
 
1:57 PM
OpenGL is the spec.
 
I love bashing open source fanboys with opengl
 
There's nothing else to be open.
 
Sirop léger
 
Well, it's like saying C++ isn't open because MSVC is closed source.
 
Well the implementation maybe
MesaGL is open indeed
@EtiennedeMartel Not exactly
 
1:58 PM
GL is hardly the only standard that has proprietary implementations.
It's like complaining Microsoft's OOXML implementation is closed.
Well, DUH.
 
@DeadMG what do you call a dog with no legs
 
I know right. I just enjoy using it as a counter argument to fanboys who say "opengl > directx cuz it be open lal"
 
@Cicada Oh. Sugar based stuff.
Maple syrup is the best.
 
opengl's pretty much as open as directx for that matter
Yeah sugar syrup
 
Open standard != open-source implementations.
 
1:59 PM
OpenGL > DirectX because it has more graphic features!
 

« first day (591 days earlier)      last day (4371 days later) »