« first day (749 days earlier)      last day (4190 days later) » 

5:00 AM
@LucDanton He said Frame myclass; myclass[x][y][z] = true; Is that what you mean?
 
I think the main common names for indexing operation are like m(x,y,z), m.at(x,y,z) and m.item(x,y,z). I like the latter because it's rare. The round parentheses are the same as in Fortran and Basic.
 
@Pubby myclass(x, y, z) and myclass[{ x, y, z }] are also options (latter is C++11 specific).
 
oh what monstrosity! :-)
 
I always wonder if at has bounds checking connotation
 
why can't we get @ as a new operator in C++
 
5:03 AM
If you want c[x][y][z] you can return a bool (&)[8][8]. Can be inconvenient if you change your private data type and must then write proxies.
 
@Pubby It does.
 
I want dollar sign operator
 
very useful for indexing and serialization and whatnot
 
dollar signs make code ugly.
 
I want to define arbitrary operators like I could in ML.
 
5:04 AM
or prolog
 
ML operators better than prolog operators
` could be used to mark new operators in C++
 
someone mentioned in an SO answer yesterday that one can always do <myNewOperator> by overloading for < and >, but i think precedence may be impractical
 
e.g. operator`>>>(int a, int b)
 
@Cheersandhth.-Alf lol
 
@Pubby not in the standard, I guess if you want stuff like that use something else. Though I admit custom operators would be useful for math and scientific programming.
 
5:07 AM
I always wondered if the cpp could be used for new operators
#define <+> works in GCC for example
Just dunno what to expand it to
 
@Cheersandhth.-Alf You can make tons in the same vein, +l+, /qux/ and so on.
 
it would expand to whatever you told it to expand to
 
@nixeagle Which would appear in infix position.
 
Oh lordy, I smell some fugly hacks coming. :|
 
Xeo
5:09 AM
Know what, I'd really like if there was a way to pass an identifier in C++.
 
@Xeo ikr
 
Xeo
And delaying overload resolution until the identifier is used.
 
ikr?
 
Xeo
Fuck all the errors with overloaded functions.
Or make everything an overloaded functor. One of both, please
 
@Xeo Sounds like you have a good frame of mind to try a lisp.
 
5:10 AM
:What luc said
 
Xeo
@Pubby "I know, right?"
 
Give us lambdas from lisp and now we want more where that came from!
 
Xeo
@LucDanton Well, I thought a bit about Haskell and why composing and lifting stuff just works so flawlessly there, and why it doesn't in C++
Now, what would be the problem if every function name actually created a functor and functors with equal names were overloaded, aka had overloaded operator() with all the different signatures?
 
@Xeo Aye but a (typical) lisp won't have the static type system and may or may not provide good support for macros (i.e. tools for metaprogramming). Those two things are, I think, relevant to the frustrations you just expressed.
 
Luc, lisp definately has macro support. LISP's macro support is much better than cpp.
 
5:14 AM
@Xeo it would be nice to get language support for functor overloading. the trick with inheritance is very ugly.
 
@Cheersandhth.-Alf I also can't get it to support functors with surrogates, but who uses that?
 
what's a "functor with surrogates"?
 
Xeo
Conversion operator to function pointer
 
Conversion operators to function references/pointers.
 
Xeo
You can create a surrogate function call thanks to that.
 
5:17 AM
oh
 
Xeo
void f(){}
struct X{ operator decltype(&f)() const{ return &f; } };
X x;
x(); // calls f
 
What would that kinda thing be useful for?
 
I think the Boost solution (Boost.Overload? Or Boost.OverloadedFunction?) may actually support that because you specify the signature of the different functors. (On the other hand I think it uses type-erasure.)
 
can it be written without using decltype and without using a typedef?
 
Well, with an alias.
operator alias<void()>* () kind of things.
 
5:22 AM
i think i meant that like in C++03
 
Xeo
Too bad you can't use trailing return type for conversion operators.
 
but wouldn't it be nice to have alias in the standard. is there a proposal?
 
Xeo
@Cheersandhth.-Alf It's really not all that useful.
 
well it looks cleaner in a way
 
Xeo
Mainly for temporary arrays and similar grammar quirks.
 
5:23 AM
:)
 
@Cheersandhth.-Alf ISTR Johannes finding a flaw in the spec with respect to conversion operators to function pointers/references, but that might have been pre-C++11. So I don't know if it's strictly speaking allowed or not without 'tricks', but in any case I know it won't work for most implementations.
 
Hmm, I'm kinda thinking, is there any reason why we can't overload arbitrary operators? I mean to do that would require specifying both operator precedence and the new operator symbol, but other than that... Any reasons why such a feature would be "bad"?
 
Xeo
@LucDanton Do you know a way to have an O(1) instantiations any_of and family?
 
To prevent multiple libraries from clashing by defining the same operators, you would just scope it.
 
Xeo
@nixeagle You'd also need to define arity, and argument positions
 
5:26 AM
Xao, don't you already get that when you specify the prototype?
I mean look how it is done for the current operators.
 
Xeo
How does operator+(a, b) tell you that the + is supposed to go between a and b?
 
@nixeagle When you do it (e.g., in ML) you pretty much have to specify all the overloads of that operator together, and can't add more later. Even so, compiling it can be pretty tricky -- ML and such use some fairly sophisticated parsing to keep it reasonable in typical cases, but I believe just about all of them are NP complete in the worst cases.
 
Xeo
Or for operator++(a, int), that the ++ is supposed to go after a?
 
@JerryCoffin not true in haskell.
Xao, ooh good one :)
 
You've said Xao twice
 
Xeo
5:28 AM
It's 'e', not 'a', btw.
 
blah :P
 
Ell
a lot of people call me eli
that's understandable though :L
 
Xeo
How cute. :>
 
I call you Eel.
 
well wait, don't you know where the operator goes based on context. Two args mean a binary operator. Anything that violates that?
 
5:29 AM
I call you EII
 
Xeo
Btw @Ell, you need a gravatar switch and I know just the right one. Can you guess? :P
 
It's an Eel.
 
Ell
I do need a gravatar
 
you would likely have to have a way to specify prefix/postfix/infix though to do it meaningfully.
 
Xeo
@nixeagle operator++(a, int)
operator()(a, b)
 
Ell
5:29 AM
not sure I could bare an eel after watching eel soup though.
 
Xeo
I actually wanted to suggest L
 
Ell
don't watch it
 
Xeo
Either the stylized letter or his face.
 
Ell
yeah I might have it as :L
 
 
Ell
5:30 AM
I don't know who L is o.O
 
Xeo
@Ell One of the main characters from Death Note, a manga and anime.
 
@Ell Death Note.
 
Get an L-shaped eel
 
Ell
ahh okay
I don't really watch anime/read manga
 
Xeo
5:31 AM
A detective, and his code name is just "L"
 
@nixeagle Really?
 
@JerryCoffin yes, through type classes.
 
Yeah but L dies.
 
Ell
:o
 
Xeo
@Rapptz Dude.
Even if an anime is very popular and ages old, don't spoiler stuff.
 
5:34 AM
L being dead isn't really surprising.
 
Xeo
It is for most people watching DN the first time.
Also, TTGL
 
Death Note is ancient. Older than I remember.
 
@JerryCoffin I may be misunderstanding what you mean, but type classes let you define (+) over new types.
 
@Xeo ew.. mecha. :(
 
Xeo
It's teh awesome.
 
5:36 AM
That paper was written in 1994, there has been a lot of development of haskell's type system since. There is all sorts of crazy stuff.
 
Never been a fan of mecha anime.
 
Xeo
Me neither, but TTGL rocks.
 
I finished TTGL yesterday
 
@nixeagle The question is not what has been added, but whether everything that could lead to the worst cases has been removed. I'm not absolutely certain, but I believe the answer to that is "no".
 
Xeo
@Pubby Opinion?
 
5:38 AM
@Xeo Have you seen it?
 
Xeo
1 min ago, by Xeo
Me neither, but TTGL rocks.
 
Or perhaps you were just talking about exactly the syntax supported for doing overloads? In that case, yes, some things have changed, but not really all that much.
 
Xeo
aka yes
 
People think I'm weird for not liking Cowboy Bebop.
 
I liked TTGL a lot
 
Xeo
5:38 AM
@Rapptz Never watched that.
I did watch Samurai Champloo though, which was quite nice
 
How can you not have watched bebop?
 
I didn't either but I figured since so many people like it I'd give it a go but it wasn't that great.
 
@Rapptz Well, they're right that you're weird. Regardless of cowboy bebop, you hang out here, which is pretty solid proof.
 
Bebop was like 7/10
TTGL was like 7.5/10
Planetes was 9/10
 
What's 10/10 on your scale?
 
5:40 AM
Nothing yet
 
Xeo
Relevant.
 
Spoiler alert on something I'll probably never watch.
:(
 
@JerryCoffin I was thinking of the syntax yes. You can make a function capable of taking arguments of any arbitrary type through multiple 'overloads', but they must be the same number of arguments. You can't do like foo(a,b) foo(a) like you can in C++.
Anyway it is getting really late here, I'll catch up tomorrow :)
 
@Xeo You hear about that kid who committed suicide a while ago because his favorite anime character died?
 
Xeo
@Pubby Nope
 
5:43 AM
I think it was in Germany
 
It was Naruto too.
 
Xeo
Oh, haven't been on Sankaku in a while, just went there and it's a news post.
 
With the way that series is going he would have been brought back to life anyway.
 
> The British tabloid newspaper Daily Mail reported on Friday that a 14-year-old Russian boy committed suicide after seeing a character in the Naruto Shippūden anime die. According to the paper, Leonid Hmelev leapt more than 100 feet (30 meters) from an apartment building and died instantly.
nvm he's russian
 
Ell
oh my gosh :O
 
Xeo
5:44 AM
Damn Narutards. :>
 
Naruto spoilers ^
 
Which character was it?
 
> Itachi Uchiha, one of the villains from the anime.
A villian, really?
 
lol'd so hard
Man I feel bad now. Still pretty funny.
 
Xeo
> “If all fans killed themselves over their favourite character’s death Dragon Ball would be in trouble.”
 
5:46 AM
I don't have much sympathy for people who kill themselves over such trivial stuff
 
Xeo
Haha, translated from 2ch as a comment on the suicide.
 
Does anyone even care if I "spoil" naruto?
 
no
 
I haven't watched it in like 3 years but I figure idk.
Itachi does get revived, iirc.
 
@Xeo Only if somebody gave a shit about characters on Dragon Ball.
 
5:48 AM
@JerryCoffin Goku's death was emotional the first 31 times.
 
Xeo
@Rapptz That's what I just read in a comment too. What a fool.
Anyways, Naruto sucks.
 
Goku dies? :(
 
It does.
@Pubby His spirit lives on.
 
Xeo
@Pubby No, Goku is the sole survivor, everybody else dies.
 
Either way I'm spoiled
Not that I care
 
5:49 AM
You've never watched DB?
 
I've seen a few episodes here and there
 
That manga is old enough to buy alcohol in the US.
Dang, that's pretty old.. 1984.
 
Yeah, my generation missed it
Being 92 and all
 
I always thought Dragon Ball (Z) was a rite of passage for people who watch anime.
 
My First Anime was pokemon
Not counting the Ghibli films I watched before it
 
5:52 AM
Pokemon, DBZ, Yuyu Hakusho, Rurouni Kenshin.
Good times.
 
Xeo
I so loved watching DBZ in the late evening here as an elementary schooler.
 
Hmm...summer of 1984. Marching around Lackland Air Force Base, then off to equally wonderful Shephard Air Force Base. Sorry, but "good times" isn't quite what springs to mind for me.
 
I watched all of these in the 90s and really early 2000s.
 
DBZ was the shit.
 
Xeo
@Pubby '91, and I saw atleast the second big season.
@Rapptz Yeah, early 2000s
 
5:55 AM
When you were a kid, there was no such thing as filler - which is what most of DBZ was - it just always seemed so action packed.
My entire family would stop homework, lunch/snacks, playing with the dog, etc.
To watch DBZ.
 
@Xeo Oh, I meant I'm 92 years old, hehe
 
Xeo
I still remember being mad as a kid because the episode was suddenly cut because of 9/11. It suddenly switched to a news show and I had no idea wtf was going on.
 
Freiza was the best.
And Trunks was so badass.
^ I didn't have high standards as a child, but still.
 
My cousins were big DBZ fans, they had a wall full of Japanese VHS of it
> About zookeeper programming with c language, what's wrong
> zookeeper programming
That exists?
 
Maybe.
 
5:57 AM
Oh, it must be a library
> Apache ZooKeeper is an effort to develop and maintain an open-source server which enables highly reliable distributed coordination.
I thought he was running a zoo :(
 
Roflmao.
Zooville, for developers.
 
Ell
I'm gonna get 2 hours of sleep now
nighty night
 
Bye
 
Xeo
Same
 
bye
i will probably catch a little bit of sleep 2
 
Xeo
6:00 AM
g'night
 
@Pubby Are the methods animals?
 
Classes are animals
 
Felidae.panthera();
 
Hm, I'm hitting an annoying problem with friendship
I split up my metafunctions to prevent access to hidden parameters
 
My minor is psychology if you want to talk. pats back
 
6:05 AM
@Rapptz I need a C++ doctor
Whoops, edited out my message
Anyway, the metafunction with hidden parameters needs to be a friend
Except I don't want to explicitly mark it as such
 
Xeo
@Pubby Search my answers for "passkey pattern"
Nighty for real now.
 
Bye
 
Niiight
 
adios.
 
Quick question for all you GCC users:
wchar_t is usually int, or unsigned int?
 
6:08 AM
I'll guess std::uint32_t
 
Not required by the standard to be unsigned. Could look it up for MinGW though
 
What does MinGW say about it?
 
It's typically defined in stddef.h
Man this file is ugly.
 
6:29 AM
@Rapptz wchar_t is a built-in type in C++. it's no longer defined in any header. but historically it was.
 
Cool.
 
@Xeo No. I can't imagine that's feasible.
 
 
1 hour later…
Florida always votes Republican. Though surprisingly in 2008 Obama won Florida.
 
8:00 AM
I can't imagine that Romney could win.
America can't be that backwards.
 
Polls are pretty close surprisingly.
Youtube's down..
 
8:36 AM
Erm... I just started watching the newest STL video, and Stephan is coding in a Notepad clone?!?
 
Hello @FredOverflow
Does anyone know where I can download herb sutters talk from yesterday? I couldn't catch it
 
0
Q: Pointer address is not incrementing

chrismsawiI have already implemented some of the recommendations before in Code Review. I also improved my code by using pointers. However, what is wrong with address incrementation part below *squeezed_str++*? It seems that address is not incrementing. Please advise. PS. substring() function is working. ...

Why do people post images of code?
 
They are a different breed of stupid.
 
That syntax highlighting....
 
8:54 AM
Interesting, it appears Scala is going to adopt structs :)
 
> We need to have a Video of your running code, otherwise we can't help you.
lol
 
lol
You can link comments here btw.
We need to have a Video of your running code, otherwise we can't help you. — bamboon 5 mins ago
2
Oh wow, someone actually typed it out?
 
I wish I could upvote edits
 
9:10 AM
> I also improved my code by using pointers.
I wanted to lol, but then I saw the tag.
 
9:59 AM
hi
Explain a
situation when macro should be prefered
over function with an example in c
 
@DextOr When you want to do generic stuff I think
min/max are a good example
Templates are of course better
 
I found this example which shows Why macro is NOT good
#define max(a,b) ((a)>(b)?(a):(b))
int x = 4, y = 5;
int z = max(x++, y++);

One would expect the x and y to be incremented once each, but the fact
is the text renders into the following:
int z = ((x++)>(y++)?(x++):(y++)),
which means the bigger of the two will get incremented twice instead of
only once.
 
Oh right, that's why macros suck
GCC has some expression syntax that you can use though
Just use templates tbh
 
@Pubby can you show me some code which prooves why Macro MUST be used in place of function :/
 
@DextOr MUST?
I think you left out a word in that sentence?
 
10:05 AM
edited :P
 
Well in C if you want min/max functions you have to define several of them
maxi, maxf, maxd, maxc for ints, floats, doubles, characters, etc
 
just give me one :)
 
Macros are more convenient I suppose
 
please give me a line of code like
#define Macro_name .... Blah blah
 
@DextOr #define f(x) g(x, #x)
there are some things you can do only with a macro.
 
10:08 AM
ok like ?
 
not C, but C++
3
A: How to output verbatim strings in C++

alestanisIf you're using C++03, you can use a Macro to do what you want: #define PRINT_STRING(s) cout << (#s) << endl; int main() { cout << "foo(\"hello\", \"world\", 5)" << endl; PRINT_STRING(foo("hello", "world", 5)) return 0; } Returns output: foo("hello", "worl...

 
Like that code he posted
 
I think that one's pretty cool. Considering I never use macros.
 
is f() and g() are fuction macros ??? @Abyx
 
f is a function-like macro and g is just a random token
 
10:13 AM
@Rapptz this example can be used ....
 
You also could have spent 1 second googling.
Don't use that, that's a C++ example.
The question you've asked has been closed as a dupe in Stack Overflow so many times that a simple search would have helped.
 
ya I know that :P
what if we do this codepad.org/tIfd44H6
 
That's C++, not C. Didn't you say you were in a C class?
 
printing foo('hello', 'world', 5) in place of foo("hello", "world", 5) ....
ya but we can convert C++ into C code
 
10:23 AM
ok I think its a bad idea :P
 
10:39 AM
I need to pass foo<int, char> into a macro and I can't add parens
Is it possible to do without variadic macros?
I suppose I could define a typedef
No wait, I can't :S
0
Q: Parenthesis in templated type macro argument and I cannot use variadic macros

PubbyI'm trying to figure out a way to get this to work without changing the structure of INHERIT: #define INHERIT(t) foo<t> template<typename A, typename B> struct bar : INHERIT(bar<A, B>) {}; The problem is that the invocation of INHERIT contains a comma. I'm trying to support ...

 
@TonyTheLion nah, that's why she was surprised :) I was laughing out loud since it sounded kind of funny. That ... erm... presenter said "A question from DeadMG" (or something) and I laughed :)
 
I come to you via the power of Raspberry Pi!
 
Oh, duplicate was found. You can close that question if you want ^^^
 
10:55 AM
actually seems rather ok performance wise
huh... is the room very quiet or is it not loading stuff... refresh should help tell me
 

« first day (749 days earlier)      last day (4190 days later) »