« first day (237 days earlier)      last day (4714 days later) » 

Foo
4:04 AM
complier is complaining about ostringstream was not declared in this scope :/
 
@Foo I forgot to put std:: before it
 
Foo
i included sstream.. am i missing something
ahh
std::basic_ostream<char> has no member named named str <- complier error
mmm
 
Don't do it all in one go
 
Foo
yeah changing it now
 
std::ostringstream stream;
stream << a;
stream << b;
...
std::string string = stream.str();
 
Foo
4:12 AM
yep that works
how to conver to const char?
i mean char*
 
Owning or non-owning?
 
Foo
owning
i think, srry.. excuse the java code monkey >.<
 
You have to do it manually (and I don't recommend it)
 
Lol… the one-liner I was trying to remember was ofstream out( static_cast<ostringstream&>(ostringstream().flush() << "check_" << check_cnt ++ << ".txt" ).str().c_str() );
 
Well ... do you want to return it from the function?
 
Foo
4:15 AM
I want to an exception msg and return it from the exception msg
 
The simple answer is don't own a char*.
In this case, let the exception own it.
 
i.e. throw std::runtime_error(string);
 
Foo
mmm, i m throwing an exception in a jni
the call is env->ThrowNew(class, char*)
i think i might of mislead of thinking char* as a string >.<
 
I'm not familiar with the API sorry.
It probably is an error message indeed but I do not know what's the idiom here.
 
Foo
its ok, just wanted to know how to return a char* built from variables elegantly
i know i can use snprintf
was wondering if there was another way
 
4:21 AM
The problem with char* is that is could be pointing to something dynamically allocated by either malloc or new or be pointing to something with static storage duration.
So I can't recommend anything in particular to pass to the function
 
Foo
can i use the c_str() call on the string returned from str() ?
 
Yes, but that gives a const char*, and it's owned by the string
 
Foo
mmm i see
 
That string is in turn a temporary.
 
You can use the c_str call at the point you pass it to Java and it makes a copy, just not before that.
For everything in between, pass around std::string
 
4:26 AM
i.e. env->ThrowNew(class, const_cast<char*>(stream.str().c_str())); but I wash my hands at what happens at runtime.
 
Foo
yeah i m giving that a run through
/fingers_crossed
 
Say hello to the little demons.
 
I'm pretty sure Java is making a copy of that char*… not to would be insane
 
But why not take a const char* then :)
 
4:31 AM
I hope it's not because they expect the C and C++ programmers to not know about const.
 
(that page says it's a const char*; it doesn't say that it makes a copy)
 
Oh that's much more reassuring!
If only I could edit away that const_cast now
 
Foo
hey guys it works :D
<3
 
Now you'll have a much easier time of porting all that Java over to C++.
 
@Foo char* is much different from const char* though :)
 
Foo
4:36 AM
this c stuff confuses me @_@, y cant i be spoon fed like in java??
 
Well… C is the lowest common denominator for interfacing pretty much any two given languages.
And this interface actually includes some C++ too… not just some SWIG hack.
 
5:28 AM
Good morning
 
5:44 AM
Good morning!
 
6:01 AM
@Potatoswatter Okay, good morning (now that it actually is morning here)
 
@JerryCoffin You're way ahead of me, actually…
 
 
2 hours later…
user379888
7:34 AM
Hi..
 
@JerryCoffin, maybe you can answer me a question before I go and write it up…
is a class template explicit specialization a template declaration?
According to 14/3, a class template declaration cannot declare an object.
 
user379888
Can anyone please help me remove a small bug in my code :'(
 
An explicit specialization does not declare a template from the point of view of the compiler; it declares a class attached to an existing template.
@JustAnotherProgrammer Not if i can't see it.
 
user379888
@Potatoswatter: Here is the complete code
https://ideone.com/RwE4k
 
user379888
Its not taking data from the file nor writing the data correctly to file.
 
user379888
7:45 AM
There are no compilaton errors so its really hard to find out the problem
 
user379888
@CatPlusPlus: I am almost done with my assignment :P
 
I'm sorry, C++ and console interaction are never used for this problem domain in the real world.
The way this endless straight-line code completely ignores the possibility of any error anywhere renders it useless and unfixable.
 
I really can't make out most of the logic in the system from i/o.
 
user379888
Its a hotel management system .. I agree unreal app
 
Also, only about 10% of the code is indented… I would probably refuse to grade this as an assignment.
2
 
7:50 AM
How unreal the app is doesn't really give you the right to couple i/o with the logic so tightly.
>Just because you can doesn't mean you should.
 
I can tell what it is, but there's no excuse for crashing and probably corrupting if a letter is entered where a number is expected, among dozens of lines of expected interactive user input.
 
user379888
ifstream infile("new.txt",ifstream::binary);
r_ptr[r_count]= new Rooms;
while(infile.read((char *)(&r_ptr[r_count]),sizeof(Rooms)))
{
        r_count++;
        r_ptr[r_count]= new Rooms;
        cout <<"Count"<< r_count;
}
 
user379888
@Potatoswatter: Here's the snippets which should be causing the problem.
 
I actually can't find that^ excerpt in between all the non-indented code.
Got it.
 
user379888
I am sorry for the bad indentation. the 10% indented code is what I have actually written.The other is my fellows work.
 
7:52 AM
I've said my peace… I have a wacky C++ question to ask and it's getting late here…
 
user379888
@KhaledNassar: You got the bug?
 
@JustAnotherProgrammer No, I got the excerpt :)
 
Meh, it's too late and I'm interpreting the standard too constructively. Of course a class template explicit specialization declares its class template.
 
@Potatoswatter You can't specialize if you don't have already a declaration for the specialized template.
 
@AProgrammer I'm kind of struggling with the language of the standard. See my comments above, addressing Jerry.
In particular see §14/3:
> In a template-declaration, explicit specialization, or explicit instantiation the init-declarator-list in the dec- laration shall contain at most one declarator. When such a declaration is used to declare a class template, no declarator is permitted.
If this doesn't apply to explicit specializations, then it is possible to declare an object (but only one, lol) with an explicit specialization:
It looks like G++ almost accepts this. Comeau testdrive rejects it more rationally.
 
8:02 AM
@JustAnotherProgrammer Since Rooms is not a POD this is bound to fail.
 
@LucDanton Also it looks like an off-by-one error compounding an assumption of file size and a horrible reinterpret_cast
But perhaps you might have an opinion on my hellish question instead? :v)
 
A specialization is not a template, is it?
Oh right that snippet is explicit about it
 
@Potatoswatter make the member public.
@LucDanton No. Not even a partial specialization.
 
@AProgrammer LOL, good catch, thanks!
I should probably get some rest before getting deeper into this…
the motivation is fixing a GCC bug, gcc.gnu.org/bugzilla/show_bug.cgi?id=49129
 
@Potatoswatter Aren't we all sleep deprived?
 
8:08 AM
So I want to know whether it's always OK to assume no declarators follow a declaration in any way associated with a template.
@StackedCrooked I didn't say I would get rest immediately, just between now and when I hit post after writing up this question :vP
 
hello
 
@TonyTheTiger gave up on quitting already?
the chat, I mean
 
@jalf yea
 
@Foo Because when C was invented, there was no such thing as a programmer who needed to be spoonfed.
 
not smoking and not chatting.... ugh :( That's too much goodness at once...
 
8:17 AM
C was a step up. Programmers were glad they didn't have to do write assembly code anymore.
 
@Potatoswatter, I think it should not be possible. An explicit-specialization is template<> declaration (so you can't define a variable). And type-specifier can't expand to an explicit-specialization.
 
@JustAnotherProgrammer Why are you opening a text file in binary mode?
 
@AProgrammer I think it shouldn't be possible too… but the standard is fairly consistent about sidestepping a connection between template<> and actually being a "template declaration"
 
@JustAnotherProgrammer Any why are you incrementing r_count before using it as an index into the array? That looks suspicious.
 
37 mins ago, by JustAnotherProgrammer
Can anyone please help me remove a small bug in my code :'(
Indeed.
At least @Miss would honestly say "I don't understand <sophisticated graphics/AI technique>"
 
8:23 AM
@TonyTheTiger Why did you want to leave?
 
@FredOverflow cause this place is very distracting...
 
@Potatoswatter Well, what about my two comments?
 
and I wanted to get a life...
but yea, then I realized my life is on the interwebs... so this is my life... lol
 
@Potatoswatter I'm sorry, digging more in depth is too time consuming for the time I've available.
 
@TonyTheTiger If you switch some characters around, you can get a file...
 
8:25 AM
@FredOverflow hahahah :)
 
Hmm I confuseded the chat.
 
@swatter you confuse me :P
 
@Potatoswatter "confuseded"? Did you just invent a new form of past tense?
 
@FredOverflow I employed the confusitron recursively.
 
8:50 AM
@FredOverflow confused is an alternative for sed pronounced as "kung-fu sed"
From there the past tense confuseded
@Potatoswatter Is a machine that looks like a kaleidoscope?
 
It would be awesome if a bug in a sed program substituted "confused" into that
@StackedCrooked A machine that looks at you may be like a kaleidoscope if you look at it properly.
After all, a kaleidoscope is a machine and all machines are classed together as such, right?
 
Everyone has a kaleidoscope in their hearts.
But you must open your heart in order to see it.
 
And little rhinestone hearts in the kaleidoscope. But you don't need to open the kaleidoscope to see them.
 
And if you rotate the kaleidscope rapidly the colors blend into one. It the color of love!
 
Why is love always puke-colored and rapidly, nauseatingly spinning?
 
8:57 AM
Love is overrated in any case.
I always tell girls they can keep their puke colored kaleidscopes and rhinestones.
 
> ...when you look long into a kaleidoscope, the kaleidoscope also looks into you
(Nietzsche)
 
> That's when I reach for my revolver.
(Moby)
 
Moby Dick?
 
@FredOverflow That's literally true: at some point the mirrors start to fall out and you'll see your eyeball.
 
@StackedCrooked What kind of girls have you met yet?
 
9:09 AM
Well, against my better judgment, but in keeping with past-my-bedtime judgment:
0
Q: Is a class template explicit specialization a template declaration?

PotatoswatterIt would be nice if this code were invalid. But it's conceptually sound, and GCC accepts it: template< typename > class t; template<> struct t< int > {} r; // Bad declarator! Don't pee on the carpet! Explicit specializations populate a kind of nether region between templates...

 
9:33 AM
@FredOverflow Girls with brown hair, blonde, long, short, all kinds really
 
Almost exactly 74000 C++ questions! Nobody ask any more!
 
but... but I have 1 more.
 
@ÓlafurWaage Sorry, we're closed! You are the 74001'th caller!
 
@Potatoswatter What's so special about 74000?
 
@FredOverflow 37 times 2000… dunno. I guess we can try for 75000, if you really feel up to it.
 
9:45 AM
No, it's 148000 divided by 2.
 
It's 272.02941017470886690059874744115^2!
 
fuck yeah!
 
Oh dear, I just asked another one.
 
Oh well… g'nite everyone!
 
10:56 AM
hai
 
what'S that weird topic line xD
 
"Netai"
 
cause we're all tired
 
11:31 AM
This is slightly off-topic, but I wonder if there are experienced gnuplot users here..
http://stackoverflow.com/questions/6305736/width-plot-with-gnuplot
 
@Nils not me. I managed to use it for very basic stuff until I figured out how to draw plots and charts with latex and tikz
 
Heh I hate tikz.. but maybe I'll have a look at it for this purpose
 
@Nils so do I. But it's nothing compared to the hatred I have towards gnuplot combined with the pain of getting anything from gnuplot to look reasonable in a latex doc
 
heh well it looks that tikz has no such plot option
 
what do you need?
 
11:35 AM
only the usual x/y math plot option
look at the picture in the question
 
ah right
 
plotting function calls as blocks by time, a simple 1d plot
 
11:48 AM
seems like I have to hack together something to plot this stuff
 
depending on how desperate you get, you could just draw the blocks manually in tikz. Should be pretty straightforward to hack together a script to do that
is basically what I did for the diagrams I needed for my masters thesis last year
made my benchmarks output .tex files :D
as long as you just need to draw colored squares, that shouldn't be rocket science
 
tikz is awesome
but it's a littl difficult to get into. quality of drawings is superb tho.
 
6
Q: Why do iterators return non-const values?

skymountainI have read Effective C++ 3rd Edition written by Scott Meyers. Item 3 of the book, "Use const whenever possible", says if we want to prevent rvalues from being assigned to function's return value accidentally, the return type should be const. For example, the increment function for iterator: c...

Five answers, five unrelated to the queston
must be a new record of some kind
I propose a new badge for this: “tl;dr”
 
ahh he's talking about some operators being const while the iterator itself isnt const?
 
He’s talking about the return value being const
 
12:02 PM
aye
 
the question is totally unrelated to iterators, the question could be asked for any UDT that overloads operator ++
I’ve taken the liberty of correcting the title
 
with the fixed title, the question makes much more sense
 
0
Q: How's the thing iterated over called?

Johannes Schaub - litbI wanted to express that an iterator is const (i.e you cannot increment or decrement it) but that the thing it yields is non-const: iterator const it = foo.begin(); it++; // error *it = ...; // not an error If iterator is a pointer, I can say: pointer // the iterator pointee // the th...

 
iteratee?
 
container :p
 
12:06 PM
does it work? iterator ends with "or". hmm
 
victim
 
lol
victor and victim?
 
so perhaps it should be "iteratim"
 
Iteratoo? Is that some kind of a kangaroo?
 
12:07 PM
aye
go to the english se site
ask there
 
i thought since "pointee" does not appear in my dict, it's not an english word
but rather, a programmers-invention
since anything in programming is inherently english, I think it'S a programmers question. just like the question "what is a pointer?" it should on-topic to ask "what is an iteratoo?"
 
Pointee doesn't have to be in a dict, it's derived using standard rules.
 
the "'-ee" extension is pretty commonly used in english though
 
ohh now I see!
please answer and I will accept
 
12:11 PM
:D
 
cpx
hmm i'm not used to see code text in bold
 
@JohannesSchaublitb, the standard seems to use value (value_type, value member in istream_iterator)
 
cpx
1:19 PM
1 hour ago, by cpx
hmm i'm not used to see code text in bold
so i asked a question

http://meta.stackoverflow.com/questions/94603/seeing-code-text-in-bold-or-regular-fonts
damn
0
Q: Seeing code text in bold or regular fonts

user144397Is it possible to make an option in user prefs to turn off seeing code text in bold for people who aren't used to or want to read it as a bold text? Here's what I see in FF4 on Windows XP SP3

 
1:48 PM
Yoyo
 
hi
 
Hello
 
2:15 PM
Any of thes people here JNI experts?
 
we disdain Java as a drug-addicted brother
so I doubt it
 
As a Java developer I judge c/c++ as the tightly strung brother who just can't be flexible
;)
 
Java is merely a tool to finish assignments to me.
 
hahaha
that's quite rich coming from Java
how about, I'd like to use friend functions? I'd like to use a custom memory allocator? I'd like to multiply inherit?
 
Speaking for myself, I despise Java with a passion. However I use other interpreted languages like C# and Python.
Java on the other hand is a no-go.
I use it because I'm required to use Java in my CS course.
 
2:21 PM
I'd like to not inherit from Object? I'd like to have nice type-safe generics? I'd like to not have to manually close() File objects and dozens of other non-memory resources that require explicit disposal?
suggesting that C++ is the one that can't be flexible is incredible
 
Static polymorphism anyone?
Template metaprogramming?
 
@KhaledNassar why would they teach you a language that is crap?
 
@Graeme: Because it's easy to teach, platform-independent IDEs and execution
 
@Graeme Because that's what the education has gone to.
 
lol
 
2:24 PM
@DeadMG Even with the simplicity of teaching Java, I'm pretty sure I know my way around it better than my own teacher.
 
Since C# and Java are syntatically almost the same, why not teach C#?
 
@Graeme Because "that's what we have been teaching"
 
There is nothing to teach in Java, really. I learned all I needed in maybe an hour.
 
@Graeme: Because in my experience, universities needlessly hate Microsoft
 
Though I'm probably biased, knowing several languages already. Oh nevermind then.
 
2:26 PM
even though C# is fairly undeniably better than Java- at least it's fixed some of it's own original flaws
 
Everyone should teach Python.
 
you know, I've never written Python
but firstly, it's dynamically typed, which is a huge fail for me, and secondly, it's got white-space indentation
ahem- indentation as block scoping
 
I learned Python but I've never got to actually use it even in making small tool/proof-of-concept projects.
 
First, yeah it is, and that's why it's so great. Second, so what? You indent your code anyway.
 
Good arguments though - that should totally convince the millions of businesses worldwide that they're wrong and should change the implementations to a language other than java... ;)
 
2:28 PM
@CatPlusPlus: You mean, that's why it's slow and unsafe? and secondly, I indent my code how I say so, not how a language dictates
 
They probably only coded in Java because they needlessly hated MS or thought it was the easiest language.
 
@Graeme: I never said that Java doesn't have advantages, and I definitely accept the cost of re-writing code in another language. Flexibility, however, is definitely a massive disadvantage of Java, not any kind of advantage.
 
Basically because C# is so tempting for such small projects, and because of the white-space indentation scheme.
 
@DeadMG What do you mean by 'slow and unsafe'? The language only says 'more indented than previous level', and you do that already. This argument is moot.
 
@CatPlusPlus: The "second" part refers to the indentation. The first part refers to the type.
 
2:29 PM
@DeadMG I know, should've split that. :P First question is for the first part.
Everyone opposed to whitespace-based blocks cry "oh, the language forces us to indent", and then go and to the exact same thing in all other languages, because, well, it's a sensible thing to do.
 
well, like, how a static type system prevents huge amounts of programmer error by yielding type errors, which massively increases the reliability of programs? And the performance, because the compiler doesn't have to look up at run-time what operation to call?
@CatPlusPlus: But not always. I have written for loops without indenting the body.
for(int i = 0; i < 9; i++) { std::cout << i; }
 
for i in xrange(10): print i
But really, that's not a good thing to do.
 
really? Because I think that it's absolutely my damn choice
 
Also, there are JITed Python implementations that are fast, so again, it's not a problem with the language per se.
 
ain't gonna be as fast as C++
 
2:32 PM
Depends on what you're doing.
 
it's the same problem as managed languages- you can JIT what you like, but as long as you're calling virtual functions for every method, it ain't gonna be as fast
not to mention that static optimization can take a long time- much longer than the JIT gets to run
 
Well, if you really need raw performance, and none of the JIT implementation suits you. Thing is, you usually don't.
 
I will accept that you don't always quite need the performance that C++ can offer
although, I would gladly pay for my hours back debugging PHP's shitty dynamic types
 
And CPython has that nice thing where you can write performance-critical parts in C++.
 
you also usually don't need dynamic types
most of the time, in reality, it's just gonna be one type anyway
and where it's not, then inheritance available in static languages easily covers the rest
 
2:35 PM
PHP type system is crap. Python yields type errors, too, only at runtime. And to be honest, I haven't seen one in a quite a while.
 
great
so I'd have to run my program, reproduce the exact error condition, and then get the error
instead of having my compiler tell me all about it at build time
 
The nice things about errors is that they come with meaningful tracebacks.
 
the only reason you'd need a traceback is to slowly and painfully debug it
instead of getting your compiler to nicely and cleanly error on it and tell you exactly what you need to know without even needing a traceback
 
Eh, okay, I'm going to stop here. I'll just say that strong, dynamic typing is not bad or that much more error-prone, and I'd encourage you to try it. Python (or any other high-level language for that matter) is just much faster and easier to write and debug, so occasional type errors are really not a problem.
 
I'd be much more convinced if you would mention, well, how any of that actually happens
 
2:41 PM
Well, not any other. Certainly not PHP. :P
 
eww, PHP
I didn't have much problems with dynamic types in Lua
but then, in Lua, you can't have more than eight types, one of which is nil
so it was pretty easy to tell them apart
 
How what happens? Type errors or ease of writing/debugging?
 
ease of writing/debugging
 
I don't know if I can explain it well. It just has an enormous array of functionality built into the language itself (and even more in the standard library), which tends to shorten and simplify the code a lot. Also neat features like introspection.
Functional constructs like list comprehensions make some things easier, too.
 
3:27 PM
I was in here yesterday I think asking about learning C before C++. I've just learned that one of my upcoming classes this fall will REQUIRE C and the other will REQUIRE C++ (per each instructor). So it turns out I'm going to have to be able to get by in BOTH. I'm comfy in Java (but no master); so my question is this: Got any suggestions for a good way to commence learning C and C++ IN PARALLEL?
 
COOKIE TIME!
 
I'm liking this for C++: amazon.com/gp/product/020170353X/…
This also came up for a search for C:
Maybe go through that PDF for C, then the book on C++?
@ÓlafurWaage Cookie time?
 
@loneboat time for a cookie. Low blood sugar, not much work done. etc. etc.
 
Oh. Thought maybe it was an allusion or something. You mean quite literally, "COOKIE TIME!"
I like when the answer's simple.
 
3:41 PM
mmmm, cookies
I forgot to order some today :(
@longboat: Oh, learn C++ first
@loneboat: C has little to offer that's not in C++ anyways
except some seriously dodgy "type safety"
 
hi
 
what's new today?
 
not much
 
The date.
 
3:59 PM
Reeeeeeally quick one then:
Are bool and "unsigned char" the same thing?
 
-.- doh
So i can't cast a unsigned char to a bool ?
 
you can
even implicitly
unsigned char c;
if (c) { // equal to: if (c != 0)
 
4:26 PM
Does anyone know a good book/article about event-driven techniques?
I'd like to check some of the event-driven patterns, mainly to broaden my horizons.
 
4:45 PM
Hey
 
user379888
Hi
 
Policy-based class is a gift for indecisive programmers.
Probably a cursed gift though.
 
user379888
Can anyone guide me with choosing between ASP and PHP?
 
@JustAnotherProgrammer Yes, choose PHP.
 
user379888
4:51 PM
I come from a C/C++ backgroud, I am confused beween which to choose
 
@StackedCrooked You shouldn't go around making all your classes policy-based because you can't decide which design to go.
 
@StackedCrooked ain't no such thing as a free lunch
 
@KhaledNassar Thank you for this valuable lesson :)
 
I haven't found much use for them around except when working on a library.
 
@JustAnotherProgrammer Um, neither?
 
4:52 PM
@JustAnotherProgrammer It depends really.
 
you can eliminate the policy later once you settle on just one, right?
 
user379888
@StackedCrooked I read that C/C++ is used in PHP but I als read that today ASP is getting better all the time.
 
but PHP is bad.
 
@JustAnotherProgrammer you just need to create a C++ class that inherits from the Poco HTTPServer class and you're good to go :)
 
Old ASP is crap, ASP.NET is meh, PHP is abysmal crap. So if you really want something just from these, pick ASP.NET.
 
4:53 PM
@JustAnotherProgrammer You probably mean ASP.NET.
 
@CatPlusPlus ASP MVC ;-)
 
user379888
@CatPlusPlus: LOL
 
It should be a choice between e.g. Ruby and Python, in which case, whatever one you like better.
 
ASP.NET is fine. PHP is ok but many language purists hate it and it is very easy to create an ungodly mess in it if you're unfamiliar with it. Classic ASP shouldn't even be in the question.
 
PHP is not even close to being ok. :P
 
4:54 PM
@JustAnotherProgrammer May I recommend Django? It's amazing.
 
@CatPlusPlus this is IMO of course
 
Which are the common Java solutions for web programming?
 
Spring, Play
play being pretty new
 
user379888
@CatPlusPlus: We dont have a choice like ruby, python or Django.. We generally do ASP.net developmet or PHP development
 
Django is Python.
 
4:56 PM
Yeah, Django + Python is actually modern technology, free without vendor lock-in.
 
Then pick ASP.NET.
 
ASP .NET
is the way to go
 
PHP is not worth wasting time on.
 
Aye ASP.NET is good.
 
user379888
May I ask why?
 
4:57 PM
@JustAnotherProgrammer If this is your area of expertise then why are you asking us? Lol
 
PHP sucks at everything except getting the job done.
 
@StackedCrooked :)
 
@JustAnotherProgrammer There is a PHP chatroom here as well
 
PHP never gets in your way of solving something, even though you solve it in a very stupid manner
 
user379888
@Potatoswatter: I just wanted a reason to keepmy mouth shut :-)
 
4:58 PM
@ÓlafurWaage I like to throw a stick in the chicken house now and then :D
 
I don't get much of the language hatred out there. C# hating on Java. The world hating on PHP. C++ hating on the world.
 
user379888
I went to Php and ASP.net chat room but they are dead..
 
PHP has: an awful type system, inconsistent grammar and sometimes downright stupid rules, standard library that was designed by a drunk monkey on PCP, ungodly stupid official implementation (with php.ini, idiotic architecture, and all that).
 

« first day (237 days earlier)      last day (4714 days later) »