« first day (427 days earlier)      last day (4520 days later) » 

8:33 AM
0
Q: Do we still have a case against the goto statement?

FredOverflowIn a recent article, Andrew Koenig writes: When asked why goto statements are harmful, most programmers will say something like "because they make programs hard to understand." Press harder, and you may well hear something like "I don't really know, but that's what I was taught." For that rea...

 
8:45 AM
goto leads to unconditional branching. Isn't it.
 
Not if you put an if before it ;)
 
that's what i studied
 
How do you mean? What did you study?
 
in school, c++ course
 
Did you learn char* or std::string first?
 
8:50 AM
char*
 
Then it wasn't a C++ course.
 
you are right in that but we (including teacher) knew that all along
c++ began much later (1 year)
 
Was it the only teacher available that knew how to turn on a computer?
 
the course is not decided by teacher
 
I mean was he a "real" IT teacher, or whatever you call it?
 
8:54 AM
what do you mean by real, "she" wasn't virtual
 
Quite often, IT is taught by math or geography teachers. People who never studied IT.
 
ohh ok. No the teacher was 100% c/c++ teacher. didn't even knew HTML, CSS or other non programming stuff
 
Nobody wants to learn C/C++. You want to either learn C or C++, but not both at the same time. And it is not necessary to learn C before C++. Most even consider it a very bad idea.
 
For goto i think it is evil and not required at all
 
"being evil" is not a very sound objection.
 
8:59 AM
again i would like to remind that the course is decided by some old and not so wise people living in some other corner of country
if a student learns goto, and likes it (:() he may end up writing messy codes entire semester
 
When I learned C++, we learned all the basics first, arrays, pointers, c-strings, etc... Then we were taught classes and templates. THEN we were introduced to string and vector...
 
instead of writing elegant if-else, functions, he'll prefer writing goto top:
 
@Mysticial Which is completely wrong if your goal is to learn C++. It will make the learning curve unnecessarily steep, and it will teach you lots of bad habits that you will need to get rid of later.
 
btw goto's syntax is not worth remembering
 
@FredOverflow It was like that both in high school and college. And I agree with them. Once you know the basics, then you will understand how all the classes and the STL library works - rather than treating them forever as a blackbox.
 
9:03 AM
good point
 
@Mysticial Oh, treating them forever as blackbox is definitely not a good idea. That's why we look into the box at the end of the semester. Arrays and pointers are taught in the last week.
 
The only thing I learned from top-down rather than bottom-up were streams. The only reason was that we needed a way to print things with cout and it doesn't make sense to make streams the first thing you learn.
 
Did you also have to learn all the details of the preprocessor before you were allowed to #include <iostream>? ;)
 
preprocessor was actually completely skipped during my first course
the only thing we needed to know what was to #include
as well as basic header guards
 
C++'s compilation model is quite a challenge for beginners.
 
9:07 AM
actually, header guards and multi-file compilation was completely skipped during my first course
 
what do you think about #define WIDTH 640
 
you're asking me?
 
Fine in C projects. But in C++ I would prefer const int WIDTH = 640;
 
anybody
of course const is preferred
 
Okay, so what do you want to hear?
 
9:11 AM
but is the former
abandonable
 
What?
It is not abandonable in C.
 
in c++
 
For me, I'm not very consistent with what I use. Actually, will you get linker errors if you do const int WIDTH = 640; and put it in a header file?
 
Sure, just have a coding standard that says "don't use macros for symbolic constants", done.
@Mysticial No, const implies internal linkage in C++. Works perfectly fine.
 
Multiple definition linker errors? I've always used macros for header constants, so I've never ran into this.
 
9:12 AM
@Mysticial Nope, no multiple definitions thanks to internal linkage.
 
ah, that's good to know
 
please suggest a git client for windows for a total noob
that's me ;)
 
Ideally one that integrates nicely into your IDE. Which IDE do you use?
 
ah visual c++ 2010 express
and code::blocks
no chance of integration here
 
9:47 AM
1
Q: Why do you use C# when there are Java and C++? (and they also came before?)

Dark TemplarJust pondering why C# seems to be so popular these days.... is it more popular than Java? I heard that syntactically they are almost the same.

> C# is better than C++ in that: It has garbage-collection.
sigh
 
@FredOverflow what's with the "was this post useful to you" questions?
 
@AlfPSteinbach What are you talking about?
 
@AlfPSteinbach That only shows up to users not logged in.
 
when i move mouse cursor of that question or any answer it pops up question box?
 
@RMartinhoFernandes If haven't been not logged in at SO for quite some time now, I guess :)
 
10:02 AM
@FredOverflow Any idea what "It allows you to treat class-methods' signatures as free functions" means?
It sounds like pure nonsense to me.
 
@RMartinhoFernandes it sounds like D-like write foo( o, "blah" ) instead of o.foo( "blah" ), or allowing the latter notation for a function of the former kind
 
But there's no such feature in C#.
 
well, that's a different matter. perhaps the author was mistaken. :-)
 
can anybody hep with this question ? stackoverflow.com/questions/8543911/…
 
@RMartinhoFernandes I think that he is talking about delegates, but I'm not sure.
@AlfPSteinbach Oh, D allows that? Neat.
@jeetmg Didn't you already get help?
3
A: Run-Time Check Failure #2 - Stack around the variable 'manager' was corrupted! and output screen does not stops even after using getchar();

Armen Tsirunyanemployee manager[size]; for(int i=0; i<size; i++) { cout <<endl<<"details of manager "<<i++<<endl; // PROBLEM IS HERE ----------->> ^^^^^ manager[i].getData(); } When you increment i on the last iteration it becomes equal to the size and manager[i]...

 
10:12 AM
how to hold the output screen ?
@FredOverflow
 
@jeetmg We have a FAQ for that, let me search...
13
Q: How to stop C++ console application from exiting immediately?

APShredderLately, I've been trying to learn C++ from this website. Unfortunately whenever I try to run one of the code samples, I see that program open for about a half second and then immediately close. Is there any way to stop the program from closing immediately so that I can see the fruits of my effort...

 
We can do cin>> name; where name is a character array?
Ow.
 
Yes, and it's a very bad idea.
 
thank u
cin.ignore();
this command worked
 
The linked FAQ lists many other possibilities.
 
10:16 AM
kk
 
0
A: casting to Integer is not working properly?

test23Thanks for contributing an answer to Stack Overflow!

WTF?
Oh nevermind that one.
-1
A: JavaScript RegEx to determine the email's domain (yahoo.com for example)

mrs joy NanaBrownman Ali My name is Mrs,Joy Nana from Libya; I am one of the Gadhafi's special nurse and guards, please I really need your urgent assistance to receive the sum of ($17.4 million) United States Dollars for safe keeping and also, for possible investment on my behalf. Upon the receipt of your co...

This one is awesomer.
 
we can just delete it on the spot
we have 3 x 20ks here :)
 
Needs 2 votes.
 
one more...
 
what r u upto guys ?
 
10:23 AM
Nuking spam.
 
@RMartinhoFernandes Hey, I was going to read that ;)
 
@jeetmg Promoting std::strings. You should use them. They rock!
4
 
You can read it in the history. But delete it first.
 
@RMartinhoFernandes What will happen to the 17 million dollars now? ;)
 
10:28 AM
Looks like Tim Post already nuked the 3 in the first one you linked to... :)
 
I wonder what that was.
 
And the user for the spam one just got nuked as well...
 
Yay, 4 kilos of flag weight.
 
0 for me
I was maxed a long time ago... lol
but I flagged those anyway
It only took 3 min. from when I flagged to when Tim Post killed the first answer... So I think they really do prioritize that much by flag weight
 
sbi
10:52 AM
What a lame tagline! You slackers!
room topic changed to Lounge<C++>: RAII handles any kind of resource, not just memory. [c++] [c++11] [c++-faq]
 
either the guys at Casual Chat are ignoring me, or they can't read english, or they are idiots.
:(
 
sbi
@IntermediateHacker Is that OR or XOR in your statement?
 
@sbi sorry, I don't get what u mean.
in Casual chat, 22 secs ago, by Mehul
Ethical Heaker,.?
retards
 
sbi
@IntermediateHacker Usually, when humans say "A or B or C", according to boolean logic, they actually mean "A xor B xor C".
 
oh. it's XOR then.
curses, I just used the word "gay" in casual chat, and everyone's like "I'll flag u!!!"
 
sbi
11:08 AM
@IntermediateHacker Why? Couldn't they be ignoring, unable to read English, and idiots? :)
 
@sbi Is that or or xor in your statement? ;)
 
sbi
@IntermediateHacker Doesn't sound too casual.
 
Don't hang out in casual chat.
 
@IntermediateHacker Did you claim Java was gay?
 
sbi
@FredOverflow Same as in yours. :)
 
11:09 AM
@sbi I know, right? Turtles all the way down :)
 
sbi
@FredOverflow Or Elephants. Or both.
 
casual chat is weird. it's not casual. It's retarded chat
 
duh
 
in Casual chat, 52 secs ago, by Adil Soomro
Scanario batao @RoshanJha. what do you want to do
lol, what do u think he wants to do?
 
sbi
@IntermediateHacker How are we supposed to know?
 
11:30 AM
Hello
 
11:43 AM
what a boring channel topic we have today
 
Als
hola!
I bought a new laptop finally
 
@Als an ASUS, or HP?
 
Als
@AlfPSteinbach: An HP 4330s
 
Als
@AlfPSteinbach: Actually I just fell for the metallic look of the HP one
So it was a biased decision
 
11:47 AM
in norway prices range from 4500 nkr to 5500 nkr, shopping.kelkoo.no/ss-hp-4330s.html
strange with such a gap in prices for the same machine
looks do count. i mean would you marry your wife/girlfriend's grandfather?
oh it's all the way up to 6500 nkr
about 2000 nkr price difference between cheapest and costliest (what's the word for that?)
 
Als
costliest is the word
 
so, you're having fun configuring everything and "registering" things and stuff? :-)
it
 
Als
@AlfPSteinbach: He he thats the wosrt part eh, trying to get it up and running
 
is like buying a car. before your first trip you have to register the steering wheel (to unlock it). and yes, oh, the engine
 
Als
And the crap load of softwares from manufacturers
feel like just stripping them off
 
11:54 AM
if it's windows, start msconfig, look in tab "startup"
 
Als
yurp
 
also perhaps start msinfo32, look in "software environment" -> "startup programs"
i have things there i don't know what they're are
like "flexnet\connect", wtf? but i think it was bundled with the laptop
 
Als
yes i know
i was living with an 512MB dell laptop before i brought this one :)
 
How can I generate binary functors?
 
"generate"?
 
11:57 AM
eh
 
Als
as in enter something and get them?
 
std::bind1st and std::bind2nd will "downgrade" a binary op to a unary op
is there an opposite way?
 
Als
aha
 
I want a way to generalize a higher-level sorting call
basically, std::sort(start, end, std::binary<std::less>(&Class::value))
"sort on value given by a member function"
for example, if I have an std::list<std::string >, I would like to sort them by length()
 
a sort predicate can be as simple as an ordinary function
of two arguments
producing bool
 
11:59 AM
can't you just write a lambda?
 
I am well away of it
@jalf not C++11
and I want a templated solution, it's not fixed
 
I don't see how it could be generalized
 
marning
 
binary predicate + member function = binary predicate that calls member function on both sides and returns predicate of that?
 
I wondered if anyone knew how to get the controls on a QWidget window to not move when the window is resized?
 
Als
12:02 PM
@TonyTheLion: grrrrr long time!
 
yea
what's been happening?
 
Als
Just the normal, How about you? been all busy dizzy
 
yea been fairly busy
 
Als
Hows the new job holding you?
 
mawning
 
Als
12:10 PM
sup @DeadMG
 
working more on my parser this morning
 
Als
hola
 
only need to implement a few more semantic actions and it's done
 
Als
sounds good.....
 
12:11 PM
yes, because there's going to be one hell of a semantic analyzer to write :D
 
@DeadMG what are you using for code generation?
 
LLVM
I'm not terrifically happy with it, but there's no alternatives
 
Not happy with LLVM? Why?
Before I started using clang, I used a different parser hooked up to LLVM and it was pretty easy to incorporate and understand.
 
because no linker
what's the point shipping a compiler with no linker?
I'm just gonna have to use someone else's codegen toolchain anyway
 
Ah. I'm packaging up binutils for the linker, etc.
 
12:16 PM
not really very helpful, since that's basically just shipping GCC
 
No, not gcc. Just binutils.
 
@RichardPennington for windows, because when built with visual c++ it fails to link, and when built with g++ it reportedly fails to handle exceptions
 
I set it up for all the targets I support. Just use the assemblers and linker.
 
i.e., because it Does Not Work(TM)
 
Oh. Windows. I try not to think about Windows.
(except maybe cygwin)
 
12:18 PM
what's the point of a c++ compiler that doesn't handle the most common platform?
 
The platform is not common at Apple ;-)
 
@AlfPSteinbach Stop nagging about the shortcomings. If you really felt they are unacceptable, you'd commit yourself to help fixing them.
@RichardPennington Note that LLVM is owned by a university, not Apple. Important difference. Lack of developers on a platform does not mean lack of patch-acceptance.
 
Yes. Seriously, clang/LLVM is really good stuff. It probably wouldn't take much effort to support windows. That are very willing to take patches.
@rubenvb I know, I can commit to LLVM.
 
the point is
 
It's just that Apple is providing a lot of economic support.
 
12:22 PM
I see little point in a code-generating back-end that can't generate code
 
@DeadMG You can always run in JIT
 
not acceptable
 
and it does generate code, it just can't create an executable or library
LLVM is perfectly suited to generating object files in its current state.
 
not remotely useful
 
and a linker is on its way
it's not like it's an easy undertaking. binutils have been at it for decades and still it sucks pretty bad.
 
12:24 PM
well, when it gets here, I might be more sympathetic to the fact that in it's current state, it's utterly worthless except for a little fun
 
@DeadMG On Windows.
 
although, in my experience, the excessive development and utter failure of the GNU toolchain is little surprise
@rubenvb You're right. Only 95% of the desktop market.
I'm sure that it's a totally ignorable platform
 
@rubenvb i think i have contributed enough of my time to the community, in particular by processing a few years worth of articles for comp.lang.c++.moderated. i do feel llvm is inadequate, and i have reported that as a bug. it's pretty insulting to say that i should then feel obliged to use even more of time to help them fix the thing.
 
@DeadMG for a lot of FOSS it is.
 
well congratulations for FOSS
 
12:27 PM
@AlfPSteinbach You're twisting my words. I said "either stop nagging and don't use it or nag until you fix it." Big difference.
 
@rubenvb your quote of yourself is a lie
 
those of us who don't want to take 20 years to develop our software, on the other hand, generally need a bit more
 
@DeadMG Never said it was a good thing. For the record I agree with what you're saying.
@AlfPSteinbach Then I speak a different dialect of English.
 
all I'm saying is that the segment that it currently supports is a vast minority of useful software
 
@rubenvb your explanation and insinuation that i don't understand english, is a lie
 
12:30 PM
@AlfPSteinbach The cake is a lie. Seriously. Not. Productive.
 
@DeadMG My only thought is that the linker, etc. is the smallest part of your worries in developing your language. the LLVM code generation infrastructure is very good.
 
the rest is entirely worthless without a linker, however
 
@rubenvb your original quote was a lie, as anyone can check. your explanation and insinuation was a lie. your latest dive into absurdity is a lie. you're a liar.
 
I can lex and parse whatever I want, if I can't turn it into .exe, it's useless
 
I don't see why it would be so hard to use the gnu linker. It does run under windoes, right?
 
12:32 PM
it's kinda large
 
@RichardPennington yes it does. And it works fine for Clang/LLVM output.
 
and over-featured
and incredibly unreliable
 
@DeadMG huh?
 
you're talking about involving a whole other toolchain whose sole distinguishing feature is those endless, worthless fucking Make files
 
lol
 
12:33 PM
and has a bad rap for absolutely everything else
 
It works very well for me, which is not to say I wouldn't drop it in a heart beat for a capable replacement.
 
@RichardPennington it works when you don't push it's boundaries. LTO is pushing its boundaries.
 
@rubenvb In what way?
 
@RichardPennington it barfs on C++.
multiple definitions, definitions in wrong sections. It's a known problem.
 
Really, the code itself or debug information, or both?
 
12:38 PM
the fix is very non-trivial and the true cause has not been determined.
The code itself.
 
Ah.
I've just started adding C++ support to my stuff, haven't encountered problems yet.
 
huh, and you compile/ link with -flto on Windows?
 
Oh, no! I develop exclusively on Linux. For the other 99% of computers in the world. ellcc.org
 
Ah, well @DeadMG and me were talking Windows primarily. Oh Linux lto is godly with the gold linker :)
 
In the past I've done LTO using the LLVM linker with everything (program and support libraries) linked as bitcode into one big as file. Worked well, but was awfully slow. It might be better now with the new type system.
But I'm targeting (relatively) small systems. Not desktops.
 
user406009
12:56 PM
0
Q: boost::function alike class

loulou2012I would like to realize a class Function similar to boost::function, the class Function can use like this in main.cpp : #include <iostream> #include "Function.hpp" int funct1(char c) { std::cout << c << std::endl; return 0; } int main() { Function<int (char)>...

 
user406009
Quite the definition of "reinventing the wheel"
 
user406009
Especially now that std::function and std::bind are in the standard.
 
There's something terribly wrong with this code, codepad.org/oPiZmjlV
what is it?
by the way, i'm not joking, but i have a fever, so perhaps i'm coding Real Dumb(TM)
 
Clang/libstdc++(GCC4.6) outputs this: pastebin.com/JprhgufE
 
well that's also what g++ says
how is template "undefined"?
 
1:11 PM
Use std::function<foo(bar)>, not std::function<foo(*)(bar)>.
 
lemme try
 
std::function is indeed not defined, but there's a partial specialization template<typename Ret, typename... Args> struct function<Ret(Args...)>; that is defined.
 
uh, this must be one of them infamous indecipherable error messages:
> g++ foo.cpp -std=c++0x
In file included from c:\program files (x86)\codeblocks\mingw\bin\../lib/gcc/mingw32/4.4.1/include/c++/functional:70,
                 from foo.cpp:1:
c:\program files (x86)\codeblocks\mingw\bin\../lib/gcc/mingw32/4.4.1/include/c++/tr1_impl/functional: In member function
 'typename std::result_of<_Functor(typename std::result_of<std::_Mu<_Bound_args, std::is_bind_expression::value, (std::i
s_placeholder::value > 0)>(_Bound_args, std::tuple<_UElements ...>)>::type ...)>::type std::_Bind<_Functor(_Bound_args .
what does it mean?
i just removed the "(*)"
 
Maybe this is more readable: pastebin.com/WU3nZgfz
 
I don't know what that means, but around the relevant line of instantiation I think the call to std::bind is wrong.
 
1:15 PM
@rubenvb thanks, but me head doesn't work!
 
Did you want bind( isLess< Type, Func >, _1, _2, f );? That would be compatible with the signature of isLess<Type, Func>. (Needs to bring std::placeholders into scope.)
 
@AlfPSteinbach Don't do std::bind when sick. Now I think about it, just say no to std::bind and go for lambda's
 
@LucDanton oh, placeholders. let me try. thanks
@rubenvb maybe you're right
maybe i'm on a learning curve here, "namespace 'std::placeholders' not allowed in using-declaration"
huh?
 
Let me reproduce.
7
 
i wrote
template< class Type, class Func >
function< bool ( Type const&, Type const& ) > lessFunc( Func f )
{
    using std::placeholders;
    return bind( isLess< Type, Func >, _1, _2, f );
}
 
1:21 PM
I'm terribly sorry. std::placeholders is a namespace. Shoddy terminology on my part.
 
oh i'm stupid
i'll add word "namespace"
It worked!
Thanks all, I think I learned or re-learned a lot there.
So here's answer to whoever it was who asked earlier
 
1:36 PM
@LiraNuna see above
 
1:50 PM
@LucDanton Out of context this is a strange thing to read... nobody is stopping you, right? Just don't do it in public.
 
2:02 PM
Dun dunn dunnnn.
 
2:14 PM
Here's something weird in my Linux: I changed /etc/resolv.conf, and when I say host some-host-name, it works fine.
 
Is there a reconfigurable std::function lookalike anywhere? I recently found myself in need of a polymorphic function wrapper that would work on movable but non copyable types, and I could imagine a policy based design being useful for other things such as optionally supplying an equality operator.
 
But when I say ping some-host-name, I get "ping: unknown host"
 
0
Q: primitive types - why are they needed?

user1094640I was wondering why people still use primitive data types rather than wrappers. Why are ints, longs, boolean etc still being used in modern languages?

 
@CatPlusPlus Why do we "still" use primitive types? I thought primitive types where only for primitive types...
 
@KerrekSB Maybe it doesn't use libresolv.
@KerrekSB I find it funny that Java is used as an example of modern language.
@Mankarse Er, function wraps function-like stuff, what do you want to reconfigure there?
 
2:17 PM
Not all function-like objects are copyable
 
@CatPlusPlus ping? What else would it use? Hmmm
 
@KerrekSB Dunno.
 
@Mankarse Why not use std::function<...>(std::ref(x))?
 
Because complicating simple stuff with policy-based design is obviously a better choice.
 
@KerrekSB: Because then the std::function would not manage the lifetime of the function object.
My specific case was implementing a task-queue on top of boost::packaged_task.
 
2:20 PM
Also, I don't think std::function requires stored thing to be copyable.
 
@Mankarse OK then, make your own wrapper that uses a smart pointer?
 
@KerrekSB: Shared ownership would not be safe, and unique ownership would not solve the problem. I could just avoid copying the std::function, but that seems too easy to get wrong.
 
@Mankarse Hm. I don't really understand your needs then, I'm afraid.
 
What I ended up doing was writing a (fairly hacky) move_function with the required semantics (hourglassii.svn.sourceforge.net/viewvc/hourglassii/trunk/…). It works, but I was hoping that there was a library solution somewhere that implemented it properly (so I don't have to).
 
2:39 PM
@CatPlusPlus It does, so I had to write a version that deals with move-only types.
 
@Mankarse I also have a todo.txt in my projects :D
 
Is that an enlarged version of your avatar?
 
no, different picture
this was taken just now, I think
 
You think?
 
2:44 PM
well I just got it from my sister
 
@StackedCrooked We tend to get into rather complex discussions over Skype, and then forget what the conclusions of those discussions were.
 

« first day (427 days earlier)      last day (4520 days later) »