« first day (480 days earlier)      last day (4483 days later) » 

sbi
10:03 AM
@sehe Believe it or not, I felt no inclination to put on my gloves, when I came outside. -8°C? Bah!
 
@sbi I'm with you. Yesterday I left my gloves off (after fixing a broken chain on my bycicle arggg) and it was ok! I think it was about -7 then. Yesterday morning it was -14 :)
oh, it didn't actually break. It derailed and jammed. Hard.
 
sbi
Hey, the standards committee hard at work:
Do you find Bjarne?
 
@sbi On the left, right there at the end.
 
@RMartinhoFernandes +1
 
sbi
@RMartinhoFernandes I don't think so. But in that image is really hard to see. See here, the larger one
Erm. I'm almost afraid to ask, but... Could it be that you guys just messed up left and right?
 
10:12 AM
I see him at the right side of the picture, third table, left side of the table.
 
sbi
Are you guys trying to pull my leg?
 
I see him tap-dancing out of the picture, in the top left corner. Wearing a very silly hat.
 
sbi
Now I'm getting grumpy.
I should go back to bed.
It's not so much "going back to bed" as it is a strategic retreat and regrouping of my awakeness for later.
 
@sbi lol
I much prefer a full on assault on the day
at 0700 I get up, dressed and down stairs fast. And I never feel sludgy in the mornings
I was going to say I get up 'hard and fast' but then thought better of it :P
 
10:32 AM
lol
 
sbi
@TonyTheLion Why am I not surprised that you would show up right after that was said?
 
oh man, the lad in India who I am working with has got a shit storm coming his way. He is really starting to hold people up
 
@sbi lol I didn't even read that
@thecoshman meh
 
@TonyTheLion wait... are you the guy I am working with?
if so, get the fuck back to work man!
 
lol
nope, not indian
 
10:44 AM
phew
:P
 
That means Tony is African?
 
nope
chuck testa
 
Chuck Testa doesn't exist
 
funky - you can be suspended for low-quality contributions? stackoverflow.com/users/434051/blender
 
10:48 AM
ends november!
 
Blender? I thought he was a cool guy :(
 
actually, I found one of his posts about Boost Geometry and svg to be very useful
 
erm... am I wrong in thinking that we conventionally would call February the second month?
and that today is actually that 8th of this month?
 
maybe something is just broken with his account - it says the account is suspended until November!!!
 
1,136 Questions, nothing less !
 
10:52 AM
he has to have a whole pile of rep points, I would think
 
OCaml: The language with full type inference yet too stupid to infer recursion or pattern matching!
 
does my answer look even remotely correct?
0
A: how to initialise this templated pair in c++?

Tony The LionOne issue I can see is that your pair has a dependent name, so it's defintion should be: typedef typename pair<const V,V> ePair; I think you need to prefix your ePair with because it also has a dependent name in it: G<class V, class E>::ePair<const V,v> e(a,b);

 
@Pubby Huh?
 
Pair itself is not a dependent name.
 
screw it, deleted my answer
I obviously have no idea what I'm talking about
 
10:59 AM
The problem is that his typedef already specified template arguments. So he doesn't need to add them a second time.
 
@CatPlusPlus It's annoying having to write rec, and match.
 
but isn't the V he uses as template parameters to pair dependent on G's template parameters?
 
That has nothing to do with inference.
 
I know, but you would think that a language with type inference wouldn't have such an unnecessary syntax.
 
You can use function p1 | p2 | p3 -> body.
Also it's just syntax.
That Haskell is better goes without saying.
 
11:03 AM
function?
Oh, I guess it's just fun.
 
9
Q: OCaml: What is the different between `fun` and `function` keywords?

RosarchSometimes I see code like let (alt : recognizer -> recognizer -> recognizer) = fun a b p -> union (a p) (b p) Or like: let hd = function Cons(x,xf) -> x | Nil -> raise Empty What is the difference between fun and function?

 
Didn't know that existed.
 
11:30 AM
@Pubby Sorry , I had to go (something urgent) , can we continue now?
 
@MrAnubis Continue?
 
@Pubby about verbatim string
 
Oh, I think @sehe was the one who knew about them
 
@Pubby does verbatim has to do with escape sequence?
or it interprets only some escape sequence?
 
@MrAnubis I think so, did you read the MSDN page on them?
 
11:38 AM
@Pubby "In a verbatim string literal, the characters between the delimiters are interpreted verbatim" << what does that supposed to mean ?
can anyone tell me in easy language what they do?
 
Exactly how they appear.
You don't have to escape anything
 
@Pubby example: string h = @"\\server\share\file.txt"; // how compiler interprets this line? can you say?
 
Same as this: "\\\\server\\share\\file.txt"
 
@Pubby That is , but how it knows where to place these "\" again?
 
You mean the quotation marks?
 
11:42 AM
@Pubby backslash
 
What do you mean?
 
:(
 
@MrAnubis It simply interprets "\" as a backslash instead of the start of an escape sequence
 
@Pubby aah , so it means , no escape sequence works inside the string , right?
 
Yes
However to insert a quotation mark " you type 2 of them: ""
 
Xeo
11:45 AM
@Pubby C++11 raw strings to the rescue!
 
And I think newlines are actual newlines
@Xeo C++11 raw strings have ugly syntax :(
 
@sbi OMG. I did fuck up left and right.
 
@Xeo I got a question about them though - can I use reserved/key words as the word?
 
@Pubby Now that made to me (Idiot of the millennium) , Thanks :)
 
Xeo
@Pubby Uhm..
 
11:47 AM
@MrAnubis No problem
 
Xeo
I think yes
R"new(\\server\share\file.txt)new"
should work, since it's really inside the string already
 
#define s Martinho
R"Martinho(Fernande)s"
 
Xeo
lol
But he's called Martinho!
Also, I don't think macro expansion occurs inside raw string delimiters
 
Don't rain on my shenanigans!
 
Xeo
> C++ uses pointers and have memory leaks , where java doesn't have pointers and there are no memory leaks (although there are logic memory leaks,I think) ..
5
Q: The main difference between Java & C++

ronBefore my exam in the following week on advanced programming , I've tried to think of the main differences between Java and C++ . From my experience with both languages : C++ uses pointers and have memory leaks , where java doesn't have pointers and there are no memory leaks (although there ...

Oh boy...
 
11:59 AM
I'd start with "everything" and then list the notable exceptions
 
sbi
@RMartinhoFernandes What's happened to your GPS module, robot?
Anyway, had a 1.5hr meeting. Now we go to have lunch and keep discussing the issues, then I'll have another meeting, probably longer than the first one. Then it will probably be beer'o'clock, and I won't have written even a single LoC yet. I hate those days.
afk
 
Xeo
Ooh, all GN sessions are now up
 
@Xeo Wow, no one even mentioned templates.
 
12:26 PM
16
Q: Why is CS taught to be memorized?

esqewI have been taking Advanced Placement Computer Science for this past year in high school. It seems as though we are taught simply to memorize code and functions and not how to be resourceful and efficient in using documentation and the like. Practically, I imagine many (if not all) programming j...

good question, buddy!
 
> C++ supports operator overloading multiple inheritance but java does not.
What is "operator overloading multiple inheritance"? :)
 
Hey hey hey ... everyone! :)
 
@Xeo The top answer isn't better than the question...
 
I've got a small non-template question :)
 
12:31 PM
?
 
Okay, I've got a Base class whose inherited attribute includes a variable called fontWidth. The font width determines the number of characters that can be printed per line. This is hardcoded information. The derived class has a method getMaxNumPrintableChars( _width ) ...
 
??
 
If the variable is private in the Base class, the Derived class won't have access to it.
 
@FredOverflow psychic debugging?
 
It's the best I can do given the low amount of information.
 
12:34 PM
... I would like getMaxNumPrintableChars() to behave as follows. If no width argument is given the currentFont is used to look up the number of printable characters. Otherwise if font width is given it is used to perform the lookup ...
@FredOverflow the fontWidth variable is protected.
 
Then provide an overload with no parameters that forwards to the one-argument version.
int getMaxNumPrintableChars(int width)
{
    // ... do stuff
}
int getMaxNumPrintableChars()
{
    return getMaxNumPrintableChars(fontWidth);
}
 
@Olumide excellent SO question material. It doesn't work here, since we'd have to be pulling information out bit by bit and it will be scattered across several pages of chat
 
@sehe Nope, I just solved it ;)
 
Ah, the problem is that lots of classes inherit the base class. I don't want to repeat the code in all the derived classes.
 
CRTP
 
12:36 PM
@FredOverflow that is what you said (chat.stackoverflow.com/transcript/message/2578681#2578681) but not how I understood it
@DeadMG +1 Or template method pattern (which has nothing to do with templates and everything with abstract methods)
 
@Olumide Then simply put the no-arg version in the base class.
 
@sehe Isn't that some run-time inheritance pattern bullshit?
 
Can the no-arg version (in the base class) call the arg version in the derived class? The arg version is specific to the derived class. Each derived class has its own arg version.
 
@Olumide Sure, just provide a private pure abstract declaration of the one-arg version in the base class.
 
@Olumide Yes. You can mark it as virtual for a run-time dispatch or use the CRTP to dispatch it statically.
 
12:39 PM
Thanks guys. I'll try it. By the way. `getMaxNumPrintableChars` is called by an instance of the derived class.
(The constructor of Base class is protected.)
 
struct Base
{
    void foo()
    {
        foo(42);
    }

    virtual void foo(int x) = 0;
};
struct Derived : Base
{
    void foo(int x)
    {
        // ...
    }
};
 
I'll give it a shot. Thanks.
 
Writing that example felt really weird. For a moment, I wasn't even sure if virtual was a C++ keyword :) Haven't used it in years.
 
template<typename T> struct Base {
    void foo()  { static_cast<T*>(this)->foo(42); }
};
struct Derived : public Base<Derived> {
    void foo(int x) { /* .... */ }
};
 
Any way around that static cast? I guess not?
 
12:43 PM
I normally encapsulate it in a method which returns a Derived&, and const overload
but no, not really
 
btjunkie dead :(
 
@FredOverflow I'm getting the same compile time error as when I first tried ...
 
Any way to ensure that T is actually derived from Base<T> in the declaration of Base? Like Java has class Enum<E extends Enum<E>> or something.
@Olumide Post a minimal example at ideone and paste a link here. We're not psychic.
 
okay :)
 
@FredOverflow Static assertions like that can go in the class body in C++11, I believe, so you can just static_assert(std::is_base_of<T, Base<T>>::value, "T must derive from Base<T>!");
 
12:46 PM
Does is_base_of work with incomplete types?
 
no
 
I assume Base<T> is incomplete at that point?
 
uh
I actually don't know
 
me neither :)
 
but worst comes to worst, you can stick it in the body of foo and it'll serve the same purpose
 
12:48 PM
But the Base template hasn't been fully parsed at that point, has it? Anyway, I'm just gonna try it later...
@Olumide My example seems to work just fine.
 
hmm
I appear to have set the compiler at ideone in an infinite loop attempting to use it to prove or disprove my point
 
lol I just noticed the same :)
And it doesn't work on GCC either.
error: incomplete type 'Derived' not allowed
But GCC accepts the static_assert inside of foo, whereas ideone still spins infinitely :)
 
yeah, ideone seems to be a spinner on thisone
 
Base<int>* q;   // doesn't generate an error
 
of course it dosn't
 
12:54 PM
Seems GCC simply ignores the static_assert inside of foo :(
 
the pointer is incomplete type
so it won't instantiate Base<int> or Base<int>::foo
 
Base<int> x;   // works silently as well
 
... :-/ ... getting a cannot instantiate abstract class compile-time error. I'll try to post a MWE
 
you have to call foo to instantiate the function
in a real struct, I'd just put it in the constructor, for example
 
@Olumide Do you want to have Base objects? Then the method shouldn't be pure virtual, and you should provide a default implementation.
@DeadMG of course, stupid me
 
12:56 PM
No I don't want to have Base objects. They are just for inheritance.
 
@Olumide Then were are you trying to instantiate the Base class?
 
Xeo
Damn, I hate double-tagged languages.
 
Show us the code that triggers the error. Again, we're not psychic.
 
@Xeo oh yeah
 
No. Just the derived. But the base objects are instantiated implicitly innit?
 
Xeo
12:57 PM
I always click the top tag to get back to C++, and most of the time C++ is not the more popular one of the tags. -.-
 
Please just show us the code.
 
Xeo
And then, suddenly, Javaland
 
Xeo
Heh
 
@FredOverflow I'm working on a MWE. I've got to extract it from my code. (My employer is very emotional about having bits of our code apper online. He even freaked when my error message contained a path that identified the company by name.)
 
12:58 PM
understandable
@DeadMG Oh, it doesn't seem to be an infinite loop, just a very long loop. It just told me that static_assert was a C++0x feature. Forgot to set it to C++0x :)
 
lol
 
next try, still looping...
Ah, done. And it only took 5 minutes and 10 seconds!
 
lol
 
Here's my MnWE ideone.com/2Xr0r
 
The Base<int> immediately failed to compile, interesting.
 
1:06 PM
Now its public
 
virtual void Foo( unsigned ) = 0;
 
@Olumide It's a pure abstract function. You need =0; instead of ; on the end.
Also, you need to using Base::Foo;
stupid name hiding rules
 
Oh wait, I think you're probably right.
 
yeah
that tends to happen :P
 
Its taking forever to compile
 
1:10 PM
maybe ideone is just way overloaded today?
 
@Olumide I fixed your example. And yes, ideone is extremely slow today. Just wait about 5 minutes ;)
@DeadMG Do you think we broke ideone with our "top-level" static_assert? :)
@Olumide Why do your parameters start with underscores? Never seen that particular coding standard.
 
It was part of the coding standard at my former university. Isit a bad idea?
 
Well, let's just say I've never seen it before.
 
I'll look up the coding standard ...
 
I'm pretty sure that as soon as you say "Starts with an underscore" you immediately go into the realms of Really Bad Ideas.
 
1:14 PM
By the way, if you're only ever going to call Foo from the derived classes, then you don't need the virtual disptach, and the CRTP approach as described by @DeadMG is preferable.
@DeadMG One underscore followed by a lowercase letter is fine unless at namespace scope, right?
But I just don't see why you would want to start parameters names with an underscore.
 
I'm not entirely sure
but you're just asking for trouble, IMO
and there's no need for it
 
agreed
 
if you're super-desperate for Hungarian notation, then it's no big deal to go p_ and m_ as prefixes
 
Isn't p_ reserved for pointers? :)
 
only in "My IDE sucks donkey dick and my function is too long" Hungarian Notation
which is generally a terribad idea whatever you do with it
 
1:19 PM
Here's the coding standard. http://nccastaff.bournemouth.ac.uk/jmacey/NCCACodingStandard/ClassLayout.html
Its what I'm used to.
 
@DeadMG I just realized that static_assert isn't really necessary, because the static_cast will fail cleanly when providing the Base template with nonsense :)
error: invalid static_cast from type 'Base<int>*' to type 'int*'
 
#ifndef _VECTOR_H_ BAD
_Ugly identifiers are reserved for the Standard library
 
Right, underscore followed by uppercase letter is bad.
 
> For ease of debugging, the object variable in a singleton class should always be named s_this.
you should never, ever have Singletons
let alone so many you need to invent a coding standard for them!
 
> Function parameters are prefixed as follows to indicate their usage (input/output/input-output).
lol
 
1:21 PM
@FredOverflow why does the Derived class have to be told about method of the Base class again? i.e. using Base::Foo;
 
@Olumide Are you done with university? Then print your standard and burn it.
 
> // private should only be used if absolutly needed
epic fail
 
@Olumide Because otherwise it is hidden.
This must be the worst coding standard I have ever seen.
 
LOL!
Why?
Its a student level programming standard.
 
> Complex types (structs or classes) should never be explicitly passed by value.
also incredible fail
 
1:22 PM
@Olumide Because header guards starting with underscores followed by uppercase letters cause undefined behavior. Why would you teach that to students?
 
It does?
 
> Parameters that are passed by value or reference should always be marked as const. For example: void setNumber( const int _number)
 
I use __VECTOR_H__ is that really really bad? ;-)
 
holy shibboleet, that's so incredibly bad!
@Olumide That's even worse.
 
@Olumide Two consecutive underscores are always reserved, everywhere.
Welcome to undefined behavior land and enjoy your visit!
// make all classes protected to allow inheritance
// private should only be used if absolutly needed
Worst advice ever. The person who wrote this coding standard obviously has no idea about object oriented programming. Please tell him to read about the "fragile base class" problem.
 
1:25 PM
bool wraps around, right?
 
@Pubby What do you mean? true + 1 is still true, not false.
 
Oh my goodness! I recently sent code peppered with such defines when a company I really want to work for asked for samples of my code :-(
 
@Olumide Did they ever answer? :)
 
@Olumide Yeah, that's double-plus ungood
 
@FredOverflow I thought ++true was false or something. It can't overflow though?
 
1:26 PM
@Pubby ++boolean_variable is a deprecated shorthand for boolean_variable = true.
@Olumide Buy this book and forget your silly University coding standard.
 
The guy who wrote the coding standard preferred ++i to i++ cos he believed it was faster.
 
well, he's an idiot
 
@Olumide ++i is actually preferred by many, and I agree.
 
but not for that reason
 
++i makes sense. It reads increment i
 
1:27 PM
@DeadMG Well, depends on the type and the compiler and the optimizer and stuff.
 
++i has cleaner semantics than i++
 
agreed
 
Also I use __STUFF_H__ at work.
 
the performance is just an extra benefit
 
90% of the programmers I talk to cannot explain to me the semantics of i++.
 
1:28 PM
I hate having to think about postfix
 
@Olumide Then your work code is UB.
 
@Olumide Again, undefined behavior. Just just STUFF_H and you're good.
But don't use STUFF__H, that is undefined behavior again.
 
I usually go for something like NAMESPACE_CLASS_HEADER
 
Okay. Thanks. I think I'll buy the book.
 
@DeadMG What if you have multiple class/ns per file?
 
1:30 PM
then split your files better
 
What if there are no classes in the header file? :)
 
eh
it doesn't really matter
you can also use something like NAMESPACE_FUNCTION_HEADER
 
I think I use LECTURENAME_MODULE_H or something, not sure.
 
I'm still confused about why I need to write using Base::Foo; even though Base::Foo is public!
 
Because Derived::Foo hides Base::Foo.
 
1:34 PM
In spite of name decoration?
 
What is name decoration?
 
mangling
 
Name mangling I meant to say :-)
 
If you don't want the using, simply change the name of the one-arg function to something else. You don't really gain anything by naming both Foo, do you?
What does name mangling have to do with it?
 
name mangling is only important/of interest when dealing with binary modules
it has nothing to say in any other circumstance
 
1:35 PM
7
Q: member function hiding free function

FredOverflowvoid foo(int) { } class X { void foo() { } void bar() { foo(42); // error: no matching function for call to 'X::foo(int)' // note: candidate is: // note: void X::foo() // note: candidate expects 0 arguments, 1 provided } ...

somewhat similar question
 
I thought Foo() is mangled to void_Foo, whreas Foo(int) is mangled to int_Foo and as such the latter does not hide the former.
 
Hiding isn't performed on mangled names
 
Decoration is a euphemism for mangling?
 
@FredOverflow I'm still confused ... sorry
 
@Pubby Sure, have you never heard of mass murderers decorating their victims?
@Olumide The name Derived::Foo hides the name Base::Foo. That's all there is to it, really. End of story.
 
1:38 PM
If mangling isn't performed on decorated names, and both Foos are decorated differently, why was I getting compile-time errors?
 
Because both names are Foo.
 
Of course it works and therefore you're right but I'd like to know why name mangling does not prevent it from happening.
 
7
Q: C++ inheritance and function overriding

legends2kIn C++, will a member function of a base class be overridden by its derived class function of the same name, even if its prototype (parameters' count, type and constness) is different? I guess this a silly question, since many websites says that the function prototype should be the same for that...

> A member of a derived class will, by default, make any members of base classes with the same name inaccessible, whether or not they have the same signature.
@Olumide Because name mangling is only relevant on the linking level. It has absolutely nothing to do with name hiding.
So a member function Foo can even hide a member variable Foo from the base class.
It's just how name resolution in nested scopes works.
 
@FredOverflow uh, what point?
 
Copy that ... "a member of a derived class will, by default, make any members of base classes with the same name inaccessible, whether or not they have the same signature."
 
1:49 PM
Hi.
What did I miss?
 
@DeadMG >"private should only be used if absolutly needed" well i used to be of that opinion, because MS stuff generally lacked customization points so that e.g. you had to copy and modify the whole print dialog thing for MFC. I also advocated making functions virtual by default. Now I think that that is akin to socialist thinking, i.e. relieves symptoms momentary but exacerbates the root problem. Not that I'm much in for conservative either. :-)
 
Xeo
@FredOverflow Inaccessible is badly worded, since you can get them with scoping.
 
If you guys care to list all the things that are wrong with the coding standard I can forward them to the author ...
 
@Olumide sorry, and i did look upthread, which coding standard?
 
Xeo
Anyways, what could be the problem if the rendered display has a slight afterimage / blurr to the right?
(And I'm talking about the Monitor display)
 
1:52 PM
@Xeo imperfectness?
 
> All indenting should be use with Tabs, set to a standard size of 2 spaces and if possible set the editor to replace tabs with spaces.
Wait, is it to use tabs or spaces?
If you set your editor to replace tabs with spaces, how can you use tabs?
 
Some IDEs e.g. gedit do just that.
 
Xeo
@RMartinhoFernandes Press tab, get spaces.
2
 
@AlfPSteinbach What do you mean by "uh, what point?"
 
1:55 PM
@Olumide looking at the project layout, it seems to require having source files in the same general storage place as object code files and other transitory tool ejecta
 
@Xeo But that's indenting with spaces.
 
@FredOverflow like, hey why did you post that?
 
Xeo
A bit like
 
Why does it matter what I press?
 
ok, so who knows how Java handles out of bounds?
 
1:56 PM
So, the coding standard forbids you from pressing the space key twice for indenting?
 
Xeo
@thecoshman Exception?
 
more specificaly, would myArray[myArray.length] = newValue throw an exception or push onto end?
 
@AlfPSteinbach Because someone was confused about hiding rules.
 
@thecoshman An unchecked exception is thrown.
 
@Xeo Can I also push bacon and receive button?
 
1:57 PM
"Tabs size should be set to 2" jesus what world is that guy living in?
 
@thecoshman Arrays don't grow dynamically in Java, so you will get an out of bounds exception.
 
it's for sure not *nix world, nor windows world
 
Xeo
@AlfPSteinbach I also have my tabs set to 2 spaces
 
@Xeo for best results do not rely on any particular tab size. default is 8 in nix and Windows console, and 4 in Windows source code. but don't rely on it. relying on a particular tab size is ungood for code that isn't completely system-specific. it will just jumble up the code for others.
e.g. the boost library sensibly requires tab-free code
thanks to dave i think :-)
 
Xeo
@AlfPSteinbach Wait
What exactly are you talking about?
 

« first day (480 days earlier)      last day (4483 days later) »