« first day (411 days earlier)      last day (4537 days later) » 

12:03 AM
@AnubhavAgarwal puzzle questions are generally frowned upon
 
every time i come in here @AlfPSteinbach is posting videos
it's annoying.
 
@keithlayne No! Arguments are evil! Pointfree code is awesome!
 
Pointfree?
As in: there is no point?
 
@ManofOneWay in java the order of evaluation is well defined for that
 
12:22 AM
@ManofOneWay Gosh, that question is full of wrong answers! You cost me a lot of rep.
 
@AlfPSteinbach Mad hot.
 
12:50 AM
@RMartinhoFernandes do you define functions always point-free?
 
No. I was joking. I do it if the functions are simple enough.
 
1:06 AM
you guys also do not see chat in meta?
 
The link is missing, yes.
But chat is still there: chat.meta.stackoverflow.com
 
1:29 AM
Anyone with foo experience here? Maybe you could help in this question: stackoverflow.com/a/8335429/46642
 
1:44 AM
Yes, it is.
 
0
Q: Is it legal to put function prototypes inside of main or another function?

MosheIs it legal to put function prototypes inside of main or another function? Is this bad practice? Why would someone put prototypes inside of main?

@RMartinhoFernandes But why would someone do that? Is it good or bad practice?
 
@Moshe See the question I linked to. I asked that before :)
6
Q: Is there a use for function declarations inside functions?

R. Martinho FernandesWe can declare functions inside functions (I wanted a local variable, but it parses as a function declaration): struct bvalue; struct bdict { bdict(bvalue); } struct bvalue { explict operator bdict() const; } struct metainfo { metainfo(bdict); } void foo(bvalue v) { metainfo mi(b...

 
@RMartinhoFernandes I'm missing something.
Is declaring functions inside another function bad practice?
 
I don't see how it could be harmful.
It's certainly unusual.
 
Also, your question is much more advanced than something a first semester C++ programmer could follow.
A friend's professor does it like that.
My professor puts them at the top.
 
1:53 AM
@Moshe Because of the code? Actually, I should have made it shorter. But you can easily read the answers.
 
@RMartinhoFernandes Yea, all about parsers and vexing parse, simple.
:P
 
> I suspect the answer (in the context of C, at least) is that this allows you to scope the existence of your function declarations to precisely where they're needed. Maybe that was useful in the early days of C. I doubt anyone does that any more, but for the sake of backward compatibility it can't be removed from the language.
This states exactly what its use is.
 
Fair enough. That's true.
 
And the second-most voted answer gives an example.
 
Ah, right, I missed that.
Ok, you win.
Havacookie.
:-)
goes to write paper
 
2:03 AM
Hey! Place to be silly?
What's up?
 
How to declare a function that takes a pointer to it's own type in C++?
Or in C?
void func(void(*param)(...???...));
 
Is that even meaningful?
 
useful it may hardly be
 
Ummmm im not very fluent in c++
But i can provide you with this link
BE WARNED: It may not be what you want
 
Maybe decltype can help.
No, it would be an infinite type.
 
yes, I tend to believe this fall into an infinite recursive definition
 
you can do with function objects, though
 
struc func
{
  void operator() (func param);
}
(missed the last semicolon)
 
ouch was that your mistake?
 
and you can also return objects of type func or func&
 
2:13 AM
@lvella You can edit posts here.
Nov 17 at 12:16, by R. Martinho Fernandes
If you are new here, please read the newbie hints. Thank you.
 
yeah i thought this place was to talk about whatever
 
@parioscreations It is. Mostly.
 
not entirely
 
> cooking, puppies, memes, sex, drugs, and, er, rock'n'roll. And anything in between.
 
the general premise of the chat is that the room owners determine what's acceptable
which is mostly anything
 
2:16 AM
ok, i know little C++ but i can talk randomly
 
but if you discuss non-C++ code-related topics, then there are more appropriate areas
and especially if you come in here, dump a link to your question just to get more attention, and then leave the chat
 
I moslty know Java and C# so...
 
impossible C++ types are on or off topic?
 
if some of the room owners don't bitch at you, it's on-topic enough
 
2:17 AM
who are the owners?
 
Their names show in italics.
 
Ok so I could discuss cool programming videos here for example? like this?
http://www.youtube.com/watch?feature=player_embedded&v=TphFUYRAx_c
 
@RMartinhoFernandes I never noticed that.
 
@DeadMG Really?
 
yeah
probably because I didn't notice when I was made one :P
also, I hardly ever actually read the names
most of the time I just look at the picture to determine who's who
 
2:24 AM
1
Q: c# Can I do this for "if"? or anyother way to doing sth like this?

chan zicoif ((((a > 0) && ((b > 0) || (c> 0) || (d> 0) || (e> 0))) || ((a1 > 0) && ((b> 0) || (c > 0) || (d > 0) || (e> 0))) || ((a2 > 0) && ((b> 0) || (c> 0) || (d> 0) || (e> 0))) || ((a3> 0) && ((b> 0) || c> 0) || (...

Protective goggles recommended for that question.
 
2:37 AM
what do you use to code C++?
"a keyboard"
 
Yeah. A keyboard, vim, and g++.
 
I love autocomplete, but I hate IDE's that provides autocomplete
 
Why's that?
 
well, I know visual studio and eclipse
I code for linux
and eclipse is big and slow
 
You can get autocomplete in vim.
 
Xeo
2:40 AM
@lvella But that doesn't have anything to do with autocompletion in IDEs.
 
I am more of an emacs guy...
 
Out-of-the-box you have Ctrl+N and Ctrl+P, that use words from the current file. This is good enough for me. But there are plugins for smarter completion.
@lvella I'm sure you can do something similar in emacs.
But you shouldn't :P
 
I like autocomplete because of external APIs
like Ogre3d and OpenGL
 
13
Q: Emacs code completion for C/C++?

ZeroCool Emacs wiki Xrefactory CEDET ? What can you recommand me ?

 
maybe I lied, probably I am no more emacs guy than vim, I don't even know lisp, and it is a pain to me to customize emacs
but I use it for small coding because I like the auto-indentation
 
2:44 AM
Ah :)
 
once I tried to setup CEDET
it made emacs much slower to open
 
I can't imagine how that's possible. Emacs is already slow enough :P
 
and the thing was lodaded even when I was editing pyhton and shell script
vim may be the way to go
if I could learn all those commands
 
Yeah, vim probably harder to learn than emacs. It's way too unorthodox.
 
I am heretic, I use emacs in CUE mode (i.e. ctrl+c, ctrl+v, etc)
I am sick, have fever, and probably being sentimental here...
 
jli
3:20 AM
Some people just baffle me..
 
Xeo
@jli I hope that whole forum isn't serious... I mean, how can one be so narrow minded? "Holy shit" indeed...
 
That's not real science. Real science doesn't use silly billions :P
 
Xeo
Oh wow.
That's just too stupid for me. I'll have to close the tabs, or I might take permanent damage...
 
You know, in C++ there's the annoying x = x++ kind of questions. In C# and Java, x = x++ is well-defined. Despite that, you still have to continuously educate programmers about what x++ does. I want to shoot who came up with the fucking "increments after" explanation. ARrgh.
 
@Xeo I am trying to figure out if this is a parody website or serious.
 
3:35 AM
@StackedCrooked it seems to be parody
 
> "If a man abide not in me, he is cast forth as a branch, and is withered; and men gather them, and cast them into the fire, and they are burned."
:D
 
I like "Scripture or it didn't happen".
It looks pretty serious to me.
 
Xeo
I like how many signatures in that first thread put woman into the kitchen by the "law of the bible"
 
> Jesus said "YOU DON'T KNOW ME BITCH!!!"
 
Xeo
Seriously, that site is nuts and should be shut down for the safety's sake
 
3:39 AM
> 27 All things are delivered unto me of my Father: and no man knoweth the Son, but the Father; neither knoweth any man the Father, save the Son, and he to whomsoever the Son will reveal him.
Hehe.
 
@parioscreations the first was just a fake video
 
Have you seen the user "titles" (or whatever those are called)?
Unsaved trash
Under Investigation
Confirmed Enemy of God
BANNED from Landover -- Aeternal Damnation Assured
Landover Senior Outreach
Touching Men, Women and Children with the Good News!
 
> And I will kill her children with death
Lol
 
Trying to out-Methuselah Methuselah
You kids get off his lawn!
This one is actually cool.
 
^ I wonder what this icon means.
 
3:44 AM
No hanging your clothes. I seem to abide by that.
 
> According to the Bible, there is exceptions
I'm stealing this one.
 
Xeo
@AlfPSteinbach Could you please stop posting videos I can't watch? :(
Either that, or make Youtube and/or the GEMA stop being so retarded. :s
 
@Xeo Here's a nickel kid, buy yourself a decent country.
 
@Xeo there's no copyrighted music or anything
 
Xeo
3:48 AM
@RMartinhoFernandes And all exception-less languages shall be doomed.
Like C
 
Early C++ compilers compiled to C. I wonder how they did exceptions.
 
@AlfPSteinbach Would be nicer with a female protagonist.
 
Indeed.
I should probably try to go back to sleep now.
 
Xeo
3
Q: Pointer to member that is a reference illegal?

fronsacqcLet us say I have: struct Foo { int i = 42; int& j = i; }; auto b = &Foo::j; Foo f; std::cout << f.*b; The compiler complains that I cannot take the address of the member because it is a reference. To be precise: Semantic Issue: Cannot form a pointer-to-member to me...

ctrl-f'ing through the C++11 standard, I can't seem to find anything that forbids this.
Maybe I'm using the wrong search term
 
You can't form pointers to references. It's probably near that.
 
3:58 AM
man
Source Code is an interesting film
 
@DeadMG Really?
 
I thought it was, anywya
 
I got really unwilling to watch it from trailers and reviews.
 
couldn't sleep cause I ate too many Pringles, and my brother has me downloading a bunch of films in HD because his connection sucks
so I figured I'd pick one and watch it
 
@Xeo Nice, now that we got one irrelevant answer to be deleted, another one pops up.
 
Xeo
4:01 AM
Ahh, found it
 
so anyway, I enjoyed it
 
int a = 1; int & b = a; // Does b occupy any stack space here? Or is it just an alias to 'a' that only exists at compile time?
 
it might do but it doesn't have to
references are like subatomic particles- they don't obey the normal rules of existence
5
however, if you could form a pointer to a reference, then it would have to exist
 
@StackedCrooked Nothing needs to occupy stack space in that code.
 
I think that might explain above question.
 
Xeo
4:04 AM
0
A: Pointer to member that is a reference illegal?

XeoC++11 standard: §8.3.1 p4 [dcl.ptr] [ Note: There are no pointers to references; see 8.3.2. [...] —end note ] §8.3.2 p5 [dcl.ref] There shall be no references to references, no arrays of references, and no pointers to references.

:)
 
imagine some hypothetical pointer-to-reference
 
@RMartinhoFernandes I'm assuming non-optimized code.
 
then &a and &b would have to yield different addresses
forcing b to exist
and preventing it's ellision
effectively, it would have to be a run-time pointer, at that point
 
@DeadMG It would make more sense to me if the answer was always "No.".
 
well
the compiler might not be able to perform the ellision
 
4:06 AM
@StackedCrooked It's the as-if rule.
 
nothing prevents you from taking a reference in, say, a function exposed through a DLL
 
I see.
 
in which case, the reference would clearly have to exist
 
That makes sense.
 
but the reference not existing, conceptually, means that the compiler has the option of making it not exist
if it's practical in implementation terms to do so
 
4:08 AM
Does this also apply to references as class members?
 
yes
 
So sizeof on a class with members that are references might yield different results on different compilers?
 
no, I think that if you sizeof it, then the reference has to exist
 
I think that compilers just treat it as a pointer when it's in a class, since anything else would terribly complicate layout.
 
because the compiler has to account for the idea that for any given construction of the object, it might not be able to make it not exist
 
4:10 AM
So by calling sizeof you'd be effectively forcing the compiler to make the reference exist.
 
well, not necessarily
you'd mostly force it to exist if you called placement new on it
or even regular new, I guess
maybe and sizeof, too
I imagine that no compiler bothers to actually make it not exist, and they mostly only make it nonexistent for stack references
it'd be realistically almost impossible to reason about other references
 
I think both @DeadMG and @Xeo's answers are not entirely correct.
 
Xeo
> When applied to a reference or a reference type, the result is the size of the referenced type.
 
Pointers to members are not pointers.
 
Xeo
No mentioning of classes containing references. :(
 
4:12 AM
@RMartinhoFernandes It is, however, exactly the same principle.
&f::b would have to be different from &f::a
 
@DeadMG Yes, I agree with that, and that's why I'm not downvoting any.
 
Xeo
> A pointer to member shall not point to a static member of a class (9.4), a member with reference type, or “cv void.”
Gonna edit that in
 
@Xeo That sounds like the right one.
 
Xeo
> Note: See also 5.3 and 5.5. The type “pointer to member” is distinct from the type “pointer”,
heh
> There is no “reference-to-member” type in C++
I wonder why not
 
anyway
 
4:16 AM
@Xeo Makes no sense.
 
I am going to attempt sleep once again
wish me luck
 
Good luck.
 
A "pointer to member" is effectively the same as a "reference to member".
@DeadMG Good luck.
 
Xeo
Yeah, but different calling syntax. :D
 
dankershun
 
4:17 AM
How would you call it? f.some_reference_to_member?
 
Xeo
(obj.rtm)(); - still needs the parens, but not *.
 
I think it's better it doesn't exist.
 
Xeo
Now that I write that, indeed doesn't make much sense
 
That would be too confusing.
 
Xeo
Saving one character.
 
4:19 AM
If bar is static function then Foo::bar == &Foo::bar. Perhaps this plays a role in the fact that you can't form a reference to member.
 
Xeo
static functions are a different thing than members. They are more like free functions
 
@StackedCrooked That's just function to function pointer decay.
I love that with auto I don't have to remember how to declare pointers-to-member.
At least not on short snippets on SO.
 
Xeo
I love how auto isn't fully auto. It won't automagically be a reference for example
 
It's half auto.
 
It chambers the next bullet, but doesn't fire it.
 
4:26 AM
const std::string & foo();
auto s = foo();
s.clear();
I guess auto has to take a copy here.
 
Yes.
Just like template <typename T> f(T); f(some_string_reference); would.
Same rules.
 
Xeo
True enough
seems like a template for variable definitions, hmmm
That's actually a nice way to think about it, if all the deduction rules apply the same
 
@Xeo Yes, they do.
auto& will always make an lvalue reference, and auto&& can make either an lvalue or an rvalue reference.
You can't do std::vector<auto> x = get_a_vector_to_something() though :(
 
Xeo
heh
but you can do auto x = get_a_vector_to_something() :P
 
Yes, but my syntax could allow the compiler to resolve overloads based on return type.
But that's not possible.
 
Xeo
4:34 AM
funny idea
 
Half-auto but not half-duck.
 
Btw, @DeadMG, will this be possible in WideC?
11 mins ago, by R. Martinho Fernandes
You can't do std::vector<auto> x = get_a_vector_to_something() though :(
 
4:50 AM
hi
 
hi.
 
Xeo
Hi
 
5:07 AM
hi
 
Aaargh you did it!
 
dammit
In Portugal people say hi twice?
 
5:21 AM
Hey, stop stereotyping.
 
Going all political now heh?
 
Speaking of stereo, have you tried a Nintendo 3DS?
 
Nope.
 
I tried on in a shop the other day, and I can't see anything decent (i.e. I always see two images). I wonder if there's something wrong with my eyes or something.
 
u need to train on cross eyed thing
i wonder how with asian fish cakes you can see white fish flesh
but with norwegian fish cakes they're just brown all around
 
5:28 AM
Fish cakes?
 
^ asian variant
 
^ It's normal to see two images.
 
@StackedCrooked No, that's not what I meant.
 
because it's TWO SCREENS, duh
 
Something like this.
No reds and blues though.
Just two slightly displaced renderings of the same picture.
 
5:32 AM
@RMartinhoFernandes That doesn't look good indeed.
 
I see normally in every other situation.
 
sbi
8 hours ago, by sbi
@DeadMG You know, now every Merkin will be seriously insulted about you being seriously insulted over being pinned as a Merkin.
 
@sbi I am seriously insulted by the word "Merkin".
@sbi were you describing meta-insulting? My head exploded.
 
if i could bring myself to care, i'd be insulted too
 
Hey, I'm winning against Jon Skeet! stackoverflow.com/a/8337016/46642
 
5:44 AM
it sounds like some little critter that lives in a cave or dungeon or something
How bout "Merkinator"? Sounds much more awesome.
 
You can call us, I don't know, Youropins maybe, if you want to retaliate.
 
europenis?
i dunno
 
what...you wanna be dicks, you might as well get called on it :)
 
European, Imapean, We'reallopean.
 
5:47 AM
I'm sure @sbi used Merkin as an affectionate term.
He even capitalized it.
 
ever looked up "merkin"? lol
 
@sbi is always classy, after all.
 
it's basically a pubic wig
 
A what? Ooops.
@cHao You're mean. I was better off not knowing that.
 
lol
 
5:50 AM
See? I was right, it is a furry critter.
 
Xeo
@RMartinhoFernandes You need to have a specific distance and angle to the screen for it to work
 
I mean, I didn't even know such a thing existed.
@Xeo Oh, why didn't they tell me that.
 
Xeo
You can also lower the 3D "settings" with a little switch on the right side of the screen
you can totally turn it of and it's just a normal nds screen
 
@Xeo Yeah, but if I'm trying out the 3D, and don't want it off.
 
Xeo
heh
Yeah, but basically, that displaced screen is how the 3DS works
And it's really awesome when you look in the right angle, but you can't have somebody watch you play over your shoulder, and it also gets tiring to the eyes after a while
 
5:56 AM
> More recently the removable sheepskin headband found on the inside of safety hardhats are referred to as merkins by many in the mining industry of Western Australia.
Obviously, in Australian it had to mean something else.
 
course.
 
6:37 AM
ok
attempt to sleep did not work
now I'm in rather horrific pain
 
What? Someone's gutting you?
 
@RMartinhoFernandes you're probably right that it's stomach pain
 
o idea
but it's fucking painul
 
for me it's not so bad with actual pain, but the thought of future pain gets to me
 
That sounds silly on-topic.
 
6:43 AM
Yes
It's not so silly if you think about it. Human nervous system is expert at ignoring non-varying inputs. Only change is important.
Of course when you're in pain all day, as I mostly am, it does affect you. But I would be much more affected by such pain coming and going. And even more if could predict it, I think.
 
fuck me!
 
no fucking way
 
this hurts a shit ton
 
@AlfPSteinbach You suffer from chronic pain, or something?
 
when it's finally over, I am sleeping for a week, then running crying back to the health system
 
6:46 AM
chronic something
 
I mean, your profile says you're 49, I don't think that's old enough to be in pain all day.
@DeadMG Wuss.
 
no no
I stop eating random junk, and it stops pulling this shit
it broke our deal
 
You said you ate a bunch of Pringles.
Doesn't that count as random junk?
 
they're usually fine
definitely junk but not random
I don't even vary between flavours
 
6:48 AM
and it's never done this to me
 
u can use pringles box as antenna to access wireless networks
:-)
wikipedia says it's not practical, though :-(
:A "cantenna" is also a brand name for a dummy load. A cantenna is a directional waveguide antenna for long-range Wi-Fi used to increase the range of (or discover) a wireless network. Origin of the name The term "Cantenna" originally referred to a product sold by Heathkit Co. in Benton Harbor, MI, USA. It was a 50 ohm resistive load used by radio amateurs. However, in the more casual vernacular of the Do-It-Yourself community, it has functionally become a portmanteau of can (e.g. an empty Pringles can, see below) and antenna, since the device is used to broadcast (and receive) ...
 
> Some jurisdictions have laws requiring residential subscribers to secure their networks.
This is really silly. I wonder what jurisdictions do this.
I bet it's West of the Atlantic.
 
ok
pain mostly over
attempt to sleep time again
wish me better luck than last tiem
 
@DeadMG Ok, better luck then.
 
sbi
@keithlayne If you are confused by this little exposure to meta stuff, you should never go to the madhouse that's meta.stackoverflow.com.
@cHao I didn't even know that. :)
 
7:02 AM
lol
i didn't either, til i looked up "merkin" :P
 
0
Q: C++11: How do I implement convenient logging without a Singleton?

kfmfe04My current implementation, simplified: #include <string> #include <memory> class Log { public: ~Log() { // closing file-descriptors, etc... } static void LogMsg( const std::string& msg ) { static std::unique_ptr<Log> g_singleton; if ( !g...

A singleton question!
A good one.
 
actually sounds like an anti-singleton question :)
which, i'll agree is the only kind of question re: singletons, but still :)
 
sbi
@RMartinhoFernandes In Germany, when someone downloads child porn over your WLAN, you better be able to demonstrate that you did what you could to secure it. If it was an open access point, they might put some of the guilt on you.
 
@sbi That's different from punishing you for having an open network.
 
sbi
@RMartinhoFernandes Well, your message said nothing about punishment, it only said you are required to tighten your network. That you are, in Germany.
 
7:05 AM
@sbi Do cyber-cafés get the blame for their customers' downloads?
 
sbi
@RMartinhoFernandes I don't think they do, although I have not yet heard of a law suite about this. People lost saw suites over their private networks, though.
 
@sbi Wait, you mean that even if the person that did the download can be identified and proven guilty, you can still suffer because of he used your network?
 
sbi
@RMartinhoFernandes I think that was the outcome of a few suites here. I'm hazy on this, though. I'm the opposite of a lawyer.
 
Ok, that does sound silly.
Imagine that I have a Nintendo DS. Those pieces of junk only work with WEP, which nowadays is pretty close to unsecured. I can't crank my access point up to decent security because of that piece of junk. So, I may be held liable for allowing someone to download child porn, but those pieces of junk are also allowed to be sold.
 

« first day (411 days earlier)      last day (4537 days later) »