« first day (458 days earlier)      last day (4491 days later) » 

Xeo
3:00 PM
return ((c&key)&&!multuple?!(p&key):(!false))?'<':'>';
 
return ((c&key)&&!multuple?!(p&key):(!false)?"<bool><not><value>false</value></not></bo‌​ol>":"<bool><not><value>true</value></not></bool>";
// Have fun, suckers
 
char InputManager::is_used(Key key, bool multuple) const
{
    return ((stateOne&key)&&!multuple?!(otherState&key):(!getNotTrue()))?'<':'>';
}
 
Xeo
I don't know what I started here...
 
@Xeo the best game I have seen in a long time
 
user406009
Wait, if (key is pressed, and not multiple), return true if otherkey is not, return false if other key is. Else return true?
 
3:06 PM
@EthanSteinberg erm, it could be that :P
 
user406009
So basically true if either stateOne | stateOne & multiple & otherKey | no keys
 
Xeo
// check if 'key' is pressed
// 'once' indicates whether holding a key down
// should return 'true' after the first step
// where the 'key' was pressed
bool InputManager::is_pressed(Key key, bool once) const
{
    bool this_step = (_down_cur & key);
    bool last_step = (_down_prev & key);
    return this_step && once? !last_step : true;
}
for those who struggle with what that even was :P
 
I think I prefer the version we came up with
 
Xeo
s/step/frame/ if you want
 
Now write that comment as haiku.
Anyway, I'm going to bed. Good night.
 
Xeo
3:08 PM
g'night
 
see you in an hour
 
sbi
@Xeo Hey, what are you working on there?
@thecoshman ROTFL!
 
@sbi we all know cats don't sleep
 
sbi
@thecoshman I thought they do little else all day?
 
@sbi there never really asleep though are they
it's like they don't trust the world to stay put
 
3:17 PM
is there an inline way of doing namespace something { void bla(); } for declarations like void something::bla();?
 
Xeo
@sbi My hobby game. :)
 
sbi
@Xeo A PacMan clone? :)
 
Xeo
No
A turn-based strategry game
 
@Xeo that's not code you wrote is it?
 
Xeo
@thecoshman It is, why?
 
3:20 PM
@Xeo: "If is_pointer was a constexpr function, this wouldn't be possible." Never Say Never Again.
 
sbi
@thecoshman I don't think any creatures beside humans sleep as untroubled as we do, and cat's, being predators, don't stand out all that much.
 
@Xeo how come you where mocking the obsufication of it?
@sbi dogs seem to manage it just fine
 
Xeo
@thecoshman Oh, just for fun.
 
sbi
@thecoshman It's a sign of intellectual maturity to be able to mock yourself.
 
Xeo
@RMartinhoFernandes Meh
That looks hideous though
 
3:21 PM
I know, but it's perfectly possible.
 
Xeo
@RMartinhoFernandes Also, I never said "never"
 
@Xeo I know, I just wanted to stick the movie's title in there :P
And there's bool_<is_pointer<T>()> from boost, which doesn't look as hideous.
 
@Xeo but if there would be no std::true/false_type, then your argument makes no sense. Maybe this argument makes no sense, but I'm just trying to think outside the box here...
 
@sbi @Xeo yeah, but it seem more like he was just generally mocking code he had found
 
And you can even do something like bool_<is_pointer<T>() && is_integral<remove_pointer<T>>()>!
 
sbi
3:24 PM
Every time someone says Scala programmers are elitist my monocle pops right out.
32 mins ago, by Xeo
can I get that any more obfuscated?
Note the I.
 
Xeo
lol
Just now, I read that as "can I get any more obfuscated?"
2
Q: What is wrong with my redirect machanism?

myWallJSONSo I try to create a C++ web server with services and stuff. It is alive here, this is how to compile in in 3 lines under regular user on Linux, and here is it svn. To redirect users I use such function: void http_utils::send_found_302( std::string redirect_lication, boost::shared_ptr<boost:...

> emo_user@gmail.com
lol
 
A "machanism" is a mechanism that can only be used by males.
 
a machanism moves faster than the speed of sound
 
hi ppl! :)
 
sbi
@Xeo IRTA "masochanism".
> Some people when faced with a problem think, I know, I'll use distributed computing. Now they have n^2 problems. — James Iry
 
3:30 PM
ppl, what does _down_cur type presents?
 
sbi
OMG! He actually links to his newbie server!
> So I try to create a C++ web server with services and stuff. It is alive here...
 
Xeo
0
Q: std::pair and class destructors

CycoMattoHow exactly does std::pair call destructors for its components? I am trying to add instances of a class to an std::map, but I am getting errors regarding the destructor of my class. I have narrowed down my question/problem to the following extremely simple example. Below, my_class merely creat...

Typical rule-of-three fail
 
what would it take for C++ functions to be able to return types? More ambiguous syntax?
 
You can return types and use decltype to retrieve them
templates just work better
 
Template aliases!
 
3:33 PM
@sbi the I has been noted
 
sbi
@DzekTrek Some variable in @Xeo's function.
 
Xeo
Welcoming close-votes on the above question.
@DzekTrek A bitfield of currently pressed buttons, std::uint64_t _down_cur;
 
@Xeo, from iostream?
 
Xeo
No, from my own class oO
 
Can't get keyboard state in standard C++.
There's no keyboard in standard C++.
 
3:35 PM
Oh, I didn't know it.
What about boost lib?
 
Standard C++ is a very abstract conecpt
 
Xeo
@RMartinhoFernandes I wonder how they even wrote the document.
 
That's why you need to do some concrete implementation of it. :P
 
Was just reading __restrict__ keyword and came across this:
THE RESTRICT CONTRACT
I, [insert your name], a PROFESSIONAL or AMATEUR [circle one] programmer recognize that there are limits to what a compiler can do. I certify that, to the best of my knowledge, there are no magic elves or monkeys in the compiler which through the forces of fairy dust can always make code faster. I understand that there are some problems for which there is not enough information to solve. I hereby declare that given the opportunity to provide the compiler with sufficient information, perhaps through some key word, I will gladly use said keyword and not bitch and moan ab
I think it applies to more then merely that __restrict__ word :)
 
Xeo
3:37 PM
There is restrict in C99 IIRC
 
it is, but it can be used in C++, as most compilers support it
from what I've read
I've forgotten what exactly pointer strict aliasing is
damnit
 
Some C users advocate -fno-strict-aliasing anyway.
 
People, do you happen to know some good site with plenty of source codes? Something like planetsourcecode.com
 
bitbucket.org
 
user142019
github
 
3:38 PM
github? sourceforge? bitbucket?
 
OK, I am in bitbucket.com.
 
Xeo
stackoverflow.com?
 
@DzekTrek Sorry, not that :(
 
It's some sort of newspaper agency or what.
?
Oh, I typed bitbucke.com instead of bitbucker.org :D
silly me
 
It was my fault :) I fixed it after posting.
 
3:41 PM
oh, thank you
 
Clang's error messages output "no member ... in namespace ..."
 
Hi, @WTP.
 
pfff
basterdz
 
How are you today man? :)
 
user142019
SOPA ftw. <— joke, should otherwise be flagged as offensive.
 
3:43 PM
Speaking of SOPa, does that mean they, the government, can exclude google.com for providing us with searches for illegal software?
 
@WTP I almost flagged you. Damn man
 
SOPA blackouts make no sense. Gov threatens to shutdown internet, so we shut it down first???
 
user142019
@Dzek Trek Every day in my life is worse than the day before.
 
user142019
I need Wikipedia tomorrow. Someone plz make a mirror.
 
I don't think any congress members use Wikipedia, or reddit for that matter.
 
user142019
3:45 PM
Or Stack Overflow
 
@WTP You can mirror The Pirate Bay on a USB thumbdrive.
 
StackOverflow is blacking out too?
 
user142019
No
 
What's wrong with (the concept of, I don't even know if it's syntactically correct):
template<typename T> using T = const T;
 
@Pubby , :( we shall all be on loss, that's for sure, if that law passes on
 
3:45 PM
@rubenvb That's not correct.
 
user142019
Or Jeff Atwood goes crazy today
 
lol
 
Aliases can't be recursive :(
 
@rubenvb , you can't use it that way
 
@DzekTrek yup
 
3:46 PM
ugh
 
but you can make one alias to call another. ;)
 
What would that even do?
 
@Pubby we choose to close it for one day to show how bad it would be if it was permanently closed with out choice
 
int x everywhere becomes const int x;?
 
ah, well, there should be a remove_const in there somewhere
 
3:47 PM
That makes zero sense.
 
I'm having a fail day today
as is clearly demonstrated in SO chat's records
 
@Pubby it should... I very much [doubt] it would actually have to worry about SOPA/PIPA
 
Parse error.
 
user142019
Pipa is Dutch for gun.
 
and polish/slavic for pus**, it's more like slang language
 
3:49 PM
@WTP whut? You must be speaking another kind of Dutch than me then
 
What's "pus"?
 
p**sy
 
@RMartinhoFernandes I assume your being coy
@DzekTrek it's ok to say pussy you know, we are adults
 
"pus" is disgusting exudae from an infection.
 
"pussy" is a cat.
 
3:50 PM
"pussy" is something entirely different.
 
pussy ALL the things
 
But SOPA will ban me if I say it in public. :D
 
@TonyTheLion pussy your mum ¬_¬
 
user142019
@rubenvb straattaal :p
 
@thecoshman If I'm a Lion, then my mum is a Lioness, so she would be a "pussy" :P
 
3:51 PM
@DzekTrek no, it will give the copyright owner of the word pussy the right to shut down SO for letting you use there copyrighted word
 
@DzekTrek You're a pussy.
 
@TonyTheLion let's just it there ¬_¬
 
@thecoshman You gotta stop eating verbs man!
 
@RMartinhoFernandes Nah, I'm the boy. @thecoshman Correct.
 
@WTP hmmm, vuile tiener turbotaal
:P
 
user142019
3:52 PM
lol
 
@DzekTrek But you're a pussy because you're afraid of writing "pussy".
 
@RMartinhoFernandes huh... you know that XKCD comic with mum next who is editing web requests at run time? yeah, that
 
@RMartinhoFernandes I guess you are right then.
 
user142019
/b/ isn't fun anymore.
 
user142019
3:55 PM
@DzekTrek he is always right.
 
-2
A: How to bypass 403 forbidden exception when request use HTTPWEBREQUEST

Peter Wolfeinsurancefor2012.c om rules We sell apocalypse insurance at a real dealbuster price

Can I get spam nuking votes here?
 
@sbi that first one looks like Neo
@RMartinhoFernandes it's not spam
just a really shit question
 
@WTP :P
 
@thecoshman What?
 
3:57 PM
@RMartinhoFernandes lets go :D
 
It's not spam?
> We sell apocalypse insurance at a real dealbuster price
How is this not spam?
What are you smoking?
 
If I go to overload all my math functions, I'd need one for each signed and unsiged char, short, int, long, long long, and double, float, and long double?
 
man look at Jon Skeet , 302k reputation
:D
 
user142019
How can one even dare to spam a question Jon Skeet answered?
 
:23886 look again
 
3:58 PM
Jon Skeet, Reading, United Kingdom
392k 98 1641 2898
 
> How to bypass 403 forbidden exception when request use HTTPWEBREQUEST
> try{ } catch { what do i write something here }
 
If I templatize everything (against general recommendation), I end up with one template declaration, an integer specialization, and one for each of the three floats
 
@thecoshman Oh, it's been nuked already.
 
FFS, another markdown point ¬_¬
 
You cannot see it because it's now deleted.
 
3:58 PM
4 against... 13
 
@thecoshman 24-0
 
grumble
 
oh, it was the answer you where wanting to get rid of :P
 
Lets all give +1 to Jon Steek. :)
 
both are equally overloadable for usercode
but the template version would give issues with my valarray plan (using SSE and the likes) and system header includes in my headers (unless I copy all *intrin.h headers to my intrin.hxx header and take out the system includes)
 
4:01 PM
@thecoshman Dammit, The Oatmeal doesn't have one for "where"/"were" :P
 
How can I see who has got the highest reputation on stackoverflow?
Do you know some of the guys in c++ fileld?
 
@DzekTrek It's Jon Skeet.
 
Users -> Reputation -> All
 
Wau... :D
 
4:03 PM
is there any assembly difference between a void f(int); int main() {short a; f(a); } and void f(int); int main() { int a; f(a); }?
@DzekTrek top three: c#, java, .net. The world isn't fair
 
@rubenvb, yes there is
 
does C++ have static inline ?
 
user142019
@rubenvb isn't that implementation-defined?
 
the first one takes much less space for consumption
 
@WTP let's say x86*
 
4:05 PM
@rubenvb Maybe not. Some calling conventions pass stuff in registers. So, anything smaller than a register would be passed as a whole register.
 
@RMartinhoFernandes damn it, I usually get those correct. I am sure he does though. I think he also needs to do one on "damn"/"dam"
 
@rubenvb It's the calling convention that matters, not the platform.
 
ok. I'll write overloads for all primitive friggin' types I get it... :(
 
(╯°□°)╯︵ ┻━┻
 
4:07 PM
What?
 
no one is allowed to have such a brilliantly ironic name. It' not fair to the rest of us
 
user142019
He is ownage.
 
oh wow, const T t has internal linkage.
had no idea
and so does typedef int T
 
@WTP well, he seem's to be ownage at web technology, so don't dish out too many cookies at once ¬_¬
 
guys, one more nice site for open source projects, www.codeplex.com
 
4:14 PM
I seem to be leaving out more and more words from my sentences. Soon I will all the time until left.
 
and the best of all www.hackchina.com
Thanks, @Pubby
ppl, do you know sites that are alike to www.hackchina.com
for non-chinese readers use english language in the upper right corner
 
You mean, sites with lots of chinese characters?
Oh, nevermind.
 
Wonder if there's a subreddit for sourcecode
 
user142019
@Pubby it's been banned reddit.com/r/sourcecode
 
4:18 PM
But why? :(
 
user142019
Dunno
 
search engine from hackchina is improving every single day :D I can tell you
I remember 1 month ago, when typing 'game' it shows some stupid searches that doesn't have any relation to what I was looking for whatsoever
 
OK, this ain't working. Don't mind Ideone's error, GCC 4.7 is fine with the constexpr... ideone.com/YlXCm
 
I'd like the template to choose operator% for integral types, and the builtin's for the floats. kiss-->std.
and I'm using @RMartinhoFernandes alias templates
it's really nonsensical to anyone not me.
maybe I don't need the enable_if at all
 
4:27 PM
@rubenvb What's the error?
 
Well, this does what I want: ideone.com/4vq03
@RMartinhoFernandes it's a link error for mod<int> (it picks the first unspecialized declaration it seems)
 
Non-template functions are picked first in overload resolution.
So yeah, you don't need any SFINAEing.
But keep in mind that short x; int y; mod(x, y); will do bad things.
Also, constexpr stuff doesn't need inline.
 
ah ok
what does the short/int thing do?
 
Not sure, but I think it will either pick one of the floating point overloads, or error out with ambiguous overloads.
 
won't the short be promoted to int?
 
4:30 PM
Because template argument deduction doesn't consider implicit conversions.
 
ah wait, I meant for everything to be a template
 
See, picks doubles.
@rubenvb But f(short(), int()) will never pick f(T, T).
You need two template arguments, and then some more complex conditions for SFINAE.
 
@RMartinhoFernandes all of em should've been templates
then I can just say, you should pass either two identical types or specify which one you want explicitely
sounds like a good plan?
like mod<int>(short(10), int(3))
which is nicely expressive but not too much?
 
That's one of the usual workarounds, yes.
A smarter one would do some decision based on the "bigger" type.
You could have a single entry function with two template parameters f(T t, U t), and that one calls f_impl<bigger_type<T,U>>(t, u);.
> Unfortunately this is for an assignment and as such we have been discouraged from using Libraries. – LBHoward 1 min ago
Sigh.
 
Has anybody got a clue on how to set the position of the global mouse ?
say for instance i am writing an application using Intel CV [which is a library that can detect guestures] the aim is that the application will be used to control mouse with hand guestures
 
4:45 PM
@RMartinhoFernandes strange, we where always told libraries where fine to use as long as it worked on the uni computers and you didn't use a library to do what you are being tested on. ie, if you are to make a physics demo, don't use a physics library
 
and i am stuck on how to set the position of mouse for the windows [ as in explorer process or say windows global mouse] .. is it possible ? if so how to do it ?
 
@Abhishek I only know how to do it for linux
well X11
 
how ?
 
@thecoshman My CG teacher allows students to use whatever they want. He even gives out recommendations if you go and ask him. Heck, he even provides some libraries himself.
 
@Abhishek oh, it is possible, but I can't recall of the top of my head
 
4:47 PM
ok, so what's the difference between a pointer aliasing another pointer and two pointers referring to the same object? From my understanding, aliasing means they refer to the same memory location. So if you create pointer to something, and then copy it, isn't that also an alias?
 
Then you deliver the project and on presentation day, if you don't understand anything of what happens in the project, he will know (he is very good at this) and you will fail.
 
@RMartinhoFernandes our maths lecturer was like that. But the more you did your self, the more you got
 
Forbidding students from using external libraries sounds to me like being lazy about evaluation.
 
@RMartinhoFernandes its not mine :(
 
@TonyTheLion Yes, that's exactly it.
 
4:48 PM
its my friends , who is bugging me since 48 hours on facebook
[ i use js and html soooo um no clue how to go it hardcore c++ ]
 
@RMartinhoFernandes so, conversely, then, the __restrict__ keyword, allows you to say that a pointer will not be aliased. However, you are allowed to copy this pointer. So how does that then make a difference to have a non-restrict keyword?
a pointer copied, is also an alias to the same memory location, no?
 
@TonyTheLion Compare these two:
The memmove() function shall copy n bytes from the object pointed to by s2 into the object pointed to by s1. Copying takes place as if the n bytes from the object pointed to by s2 are first copied into a temporary array of n bytes that does not overlap the objects pointed to by s1 and s2, and then the n bytes from the temporary array are copied into the object pointed to by s1.
The memcpy() function shall copy n bytes from the object pointed to by s2 into the object pointed to by s1. If copying takes place between objects that overlap, the behavior is undefined.
restrict only matters to the pointers passed as arguments.
 
int x = 15; int *p = &x; int *v = p; now v aliases x as well as p?
 
memmove doesn't care, and it will work with pretty much everything you feed it. memcpy cares and requires that you don't pass the same pointer in two arguments.
 
@RMartinhoFernandes well, if I asked you to demonstrate your knowledge of how to make a linked list, I would not consider using the STL to show your knowledge much at all
 
4:52 PM
@TonyTheLion Yes, but restrict is not useful there.
 
@Abhishek on X11 you can do it with XTest - stackoverflow.com/questions/7221600/…
 
@awoodland thanks ^_^
 
@RMartinhoFernandes hah, so restrict is useful only when you are passing pointers to a function, and want to make what you're being passed is not something pointing to the same memory location.
 
sbi
@RMartinhoFernandes Wow, I didn't know these are oneboxed.
 
@TonyTheLion Yes, though they may point to different locations.
 
4:55 PM
@RMartinhoFernandes yes, that's the point. no pun intended
 
@Abhishek msdn.microsoft.com/en-us/library/windows/desktop/… looks like the win32 equivalent
 
@awoodland omg you are a life savior :D
 
@TonyTheLion No, I mean, restrict says that the pointer or a value derived from it will be the only way to access the object it points to.
In the case of memcpy it forbids, for example: memcpy(&arr[0], &arr[3], 6);.
 
@RMartinhoFernandes ah ok. But it also says that restrict allows one to copy the pointer. Which to me would be a form of aliasing, or have I got it wrong?
 
The callee can do anything it wants with the pointers once they're passed.
 
4:58 PM
seriously i should come back to C++ grounds :)
 
Because a value derived from the first pointer can be used to access &arr[3].
 
-time to give up javascript- :|
 
oh I see
 
@sbi Sadly they look as awful as possible.
They don't even show the damn function signature.
 

« first day (458 days earlier)      last day (4491 days later) »