« first day (323 days earlier)      last day (4618 days later) » 

4:00 PM
lol
 
4:18 PM
well, dinner done and looked at that to-string-conversion code again. don't know how many C++ rules I've broken here? except for the pragma once, i know, but that's intentional.
it seems to work -- with visual c++...
 
pragma once works in every major compiler now, AFAIK.
 
Really? Heh ... somebody took a cue from MS?
 
It's way more convenient and much less error-prone than include guards.
 
(that is neat if it works everywhere now)
very true ... two words says it all
 
It certainly works in GCC and Clang.
 
4:21 PM
cool :)
 
i am guessing that it works not in Sun CC
 
If I could ask Bjarne one question (and one question only), I would ask "Will C++ ever get rid of header files?"...
 
that's because every time I have believed something worked across all extant compilers, James Kanze has mentioned Sun CC
 
I'll still hope they'll get modules into the next standard.
Anyone uses Sun CC?
 
I used it once to convert C code to SPARC assembly code.
 
4:24 PM
I use it from time to time still
 
A product I used to do support for supported it, but I don't recall getting calls from that many customers on it
That doesn't mean much, of course
 
You can always automate include guard insertion via build system for stupid compilers.
Oh how much I hate frontends.
Especially HTML ones.
 
Ugh :(
HTML
 
I think this project will be useful in a way, I'll finally learn how to use Comet (and maybe WebSockets) properly.
 
for all the metal heads, epic intro :)
@CatPlusPlus which project? Creating new chat?
 
4:31 PM
Yeah.
 
oh kewl
> As of March 2009, the indexable web contains at least 25.21 billion pages
holy tart, that's a lot
 
That's a lot of nuts!
 
hahah
 
@LucDanton hi
 
Als
hmm
 
4:40 PM
ohla @Als
 
Als
hola back at you @TonyTheTiger
ahh work day tommorow...
 
how are ya?
yes, work day, if you have work
 
Als
@TonyTheTiger: hmm..And you can have one but you didn't yet
We had a long weekend
worked only on friday since last week's wednesday
so bored
 
what is work?
you do
 
Als
@MrAnubis: Work is being in a place other than where you stay for atleast 8 hrs a day, sit in front of a computer, and pretend you are doing something important.
 
4:45 PM
hahah
 
So, almost every job ever?
 
basically yes
 
Oh, sorry, misread.
 
oh like i c++
 
Als
@MrAnubis: What does that have to do with what is work? :P
 
4:46 PM
i do at home
 
Als
@TonyTheTiger: How do you interpret this..
39 secs ago, by Mr.Anubis
i do at home
:P
 
2 mins ago, by Als
@MrAnubis: Work is being in a place other than where you stay for atleast 8 hrs a day, sit in front of a computer, and pretend you are doing something important.
a response to this
 
So, you're pretending to work even at home? That's workaholism.
 
no no you wrong
 
Als
@TonyTheTiger: Uh...Impressive, I can never relate, things here in chat
 
4:48 PM
i student
 
Als
wheres that bot today?
 
what bot?
 
I just realized that our bot hasn't been here all day, he must be sick or something
 
this sucks, i don't find the original BÖC cowbell video on YouTube, only PARODIES of it.
 
4:49 PM
i need help in c++
 
He's fighting crime in Detroit.
 
i need help in housekeeping
 
@anubis: attention to detail is a good thing. but what are you stuck on now?
 
Als
@CatPlusPlus: What happened in detroit
@StackedCrooked: Will work for coding in C++
:P
 
i was helped by mr. LUC but again got confused
 
Als
4:51 PM
@AlfPSteinbach: The moderated comp.lang sucks! It takes forever to get an answer?
 
this statement - > typename a<T>:: template b<T> *Z
 
@Als at least a day
 
Als
@StackedCrooked: Too slow!
 
why we put typename since b<T> is templates has shown by previous template keyword in statement
 
ok spill it
@Als Actually Johannes has replied twice to your posting.
 
Als
4:53 PM
@AlfPSteinbach: Doesn't show me!
 
video for me?
 
@Als That's because nobody's taken the time yet to process the incoming messages.
 
Als
@AlfPSteinbach: Are you on the mod list there?
 
@MrAnubis no just for the chat at large
 
@AlfPSteinbach : this statement - > typename a<T>:: template b<T> *Z
@AlfPSteinbach why we put typename since b<T> is templates has shown by previous template keyword in statement
 
4:55 PM
@Als there are just 2 to 3 active moderators
 
so why put typename to show type?
 
it tells the compiler that what follows is a type
search for "dependent name"
 
Als
@AlfPSteinbach: how did you get to know, litb posted twice? Or one can see the queued messages for moderation?
 
which is already told by template keyword that its a class template
i knw dependent name but just confused
 
@Als i used to be the most active moderator, but i'm not well, so i cannot use the time
 
4:57 PM
@AlfPSteinbach : can you answer me too?
 
Als
@AlfPSteinbach: ah okay. I hope you are on road to recovery to an 100%.
 
anyone ill?
 
Arcade Fire is Windowsill
 
Arcade firre seems like old video
 
Als
okay folks, need to move out. have a good time. see ya around.
 
5:01 PM
who?
 
@MrAnubis I suggest look at the FAQ about dependent names
I'm sorry, wrong link. Here's FAQ item: parashift.com/c++-faq-lite/templates.html#faq-35.18
 
@AlfPSteinbach : this statement - > typename a<T>:: template b<T> *Z
, i am just saying typename in starting of statement in not required cause b<T> is templates class TYPE has already shown by previous template keyword before b<T>
or i need take some rest from templates?
@AlfPSteinbach : can you prove me wrong?
 
5:16 PM
@MrAnubis can't you prove yourself wrong?
but essentially, even though compiler knows it's a template (because you have told it), it doesn't know that it's guaranteed to be a type, unless you tell it.
 
@AlfPSteinbach: so right , thank you sir
 
you're welcome
 
Hi all
 
Hi mahesh what is up?
 
Tired and feel lazy early in the morning
 
5:24 PM
here is night , going to sleep)
 
Europe ?
 
Nepal
 
k
 
you're indian seems like from name
are you?\
 
Yup
 
5:27 PM
a puzzle for you -> You are in a room with 3 switches which correspond to 3 bulbs in another room and you don't know which switch corresponds to which bulb. You can only teleport to the room with the bulbs and back once. You can NOT use any external equipment (power supplies, resistors, etc.). How do you find out which bulb corresponds to which switch?
 
that is cheating to find answer on google ( though i myself found it on google)
 
This is not really an answer.
Well, somewhat.
 
yes it is
 
5:30 PM
I'm not really interested in puzzles like that.
 
you're bad cat
 
he is interested cats
:P
 
I know, I'll try out Pyjamas for this project.
 
lol
 
@CatPlusPlus Pyjamas?
 
how do people come up with these funny framework names?
lol
 
let me give u guys a puzzle
 
a more funny language is Brain fuck
that surely does what name says
 
We call it *rainfuck around here, to avoid profanities.
 
aah
 
5:33 PM
Hello.
 
hellalujo
today is my first time in chat , and i am loving you guyz
its good to chat with professionals
 
We're professionally silly.
Well, except for @sbi, he's professionally grumpy.
 
Professionals. Nice joke.
 
There are a group of 1000 soldiers wearing t-shirts numbered from 1-1000. They were given a task of either opening/closing the doors of 1000 apartments of a army complex. Now the condition to open or close the door is if the number on the T-Shirt he/she is wearing is divisible by the door no, then he can do opening/closing operation on it. Meaning if it is opened then he/she does close the door and vice versa. At the operation, how many doors would be opened and closed :)
 
5:36 PM
Many.
 
looks like mahesh is on revenge
 
As programmers we only know 0, 1 and many.
2
 
And we bash 1 frequently.
 
what if the door numbers are only large primes?
 
5:38 PM
 
or they're all larger than 1000
 
That was relevant.
 
@awoodland No, the door numbers are also numbered 1-1000
 
@TonyTheTiger Mmm.
 
@RMartinhoFernandes don't you love that stuff?
 
5:39 PM
do the soldiers visit every door each? or only one door?
 
1 max=1000
2 soldiers = range(max)
3 idx = 0
4 while len( soldiers ) > 1 :
5 idx_kill = ( idx+1 ) % len(soldiers )
6 idx = ( idx_kill ) % ( len(soldiers) -1 )
7 del soldiers [ idx_kill ]
8 print soldiers
so easy question
 
What language is that? BASIC?
 
Poorly copy-pasted Python.
 
5:40 PM
we don't talk programming here, we talk other things
 
cat guy is very smart
 
@TonyTheTiger Yes, the other things of programming :)
 
lulz
I'm bored :P
 
@awoodland Each soldier visits each door
 
@Mahes - I was sure you were going to tell me there was a really nice pattern in there that fell out
 
5:42 PM
@awoodland Sees the number on T-shirt and the door num, and if it is divisible he can do an action on it or else he just leaves to the next door and so on
@awoodland Yes, there is a pattern in it
calculate the first 3-4 numbers manually, then we see a pattern to say which door is opened and which one is closed :)
@MrAnubis I don't think you got it right
 
I would but I'd have to find a pen and the back of the only envelope to hand is covered in scribbles :)
 
@awoodland I was asked this question in an interview 3 years back
 
why this is illegal and invalid

double *p1;
const double **p2(&p1);
 
If it helps, this is valid: double *const *p2(&p1);.
 
5:51 PM
I don't remember last time I needed pointer to pointer.
 
i know that is valid, by i want to know what is problem with firste case :)
first*
 
There is a built-in conversion from T* to T const*. But there's no built-in conversion that applies in your situation.
 
thank you
 
If you really want that, you can do double const* p1_5 = p1 first.
Something to bash!
0
Q: Linking error while using htmlcxx with dev-cpp

HarryI have small program using htmlcxx but when I try building the code it gives linker error. I just downloaded the htmlcxx.084.zip, unzipped it and placed it in Dev-Cpp\include\c++\3.4.2\htmlcxx. The code does not give any build error but the linking fails. [Linker error] undefined reference to `h...

@CatPlusPlus Gosh, took me a while to get that joke.
 
imagine you needed to make linked list of 1mill elements, would you use a memory pool for allocation, so you have more contigious memory blocks, rather then alloc when you need?
 
6:03 PM
@tony list as in std::list?
 
With std::list it's easy enough to switch between the two, so measure.
 
@awoodland any linked list really
 
@awoodland Isn't the underlying implementation of std::list is a doubly linked list ?
 
There's std::forward_list now.
 
@RMartinhoFernandes yea, I was just reading an article about hardware prefetcher and how it prefers contiguous memory block accesses or at least patterned accesses and things like trees and linked list, don't necessarily store things in a continguous fashion
so that's why I asked
 
6:05 PM
@TonyTheTiger Yeah, those kinds of structures tend to have bad locality.
 
@Tony if it's always exactly 1000000 you could do a trivial allocator using std::array
although that might defeat the point of calling it a linked list somewhat
 
One of the advantages of a linked list is the fact that there's no need to allocate memory for more elements than the list has. Using a memory pool would reduce that advantage somewhat.
Like many things in this business, it's a tradeoff you have to consider.
Another advantage is quick insertion or deletion in the middle, something where arrays don't quite cut it. Depending on the insertion and deletion patterns of the program, you could end up having linked nodes very far away from each other even using a contiguous pool of memory, and thus reducing the locality advantage of the pool.
Another tradeoff to consider.
 
@RMartinhoFernandes insertion and deletion in middle of array is O(1), if you use cursor gap technique. so it's not so much the array or list, as how you use it.
gah, editing. and those who have speakers or headphones on probably get a "ping!" each time I correct one character. but it takes too much time to learn to type correctly...
 
6:17 PM
I don't mind. I'm sure I make some of you guys suffer through the same thing sometimes ;)
 
In computer science, a gap buffer is a dynamic array that allows efficient insertion and deletion operations clustered near the same location. Gap buffers are especially common in text editors, where most changes to the text occur at or near the current location of the cursor. The text is stored in a large buffer in two contiguous segments, with a gap between them for inserting new text. Moving the cursor involves copying text from one side of the gap to the other (sometimes copying is delayed until the next operation that changes the text). Insertion adds new text at the end of the fir...
 
@AlfPSteinbach Yes. It depends a lot on how your program is going to use the data structures.
I can skip calling the destructor if there are no resources to cleanup, can't I?
(No, not even memory. Nothing. And yes, I know it's a nasty idea.)
 
@RMartinhoFernandes Huh, what are you doing where you're calling destructors?
 
Imagine it's a POD type constructed with placement new.
 
Destroying all humans objects.
 
6:21 PM
There is nothing to clean up.
 
Then yes
 
Ok.
And if it's a non-POD that doesn't hold resources (again created with placement new)?
 
Depends how sure you are that it doesn't hold resources. E.g. a std::string allocates memory
 
It's my own type that holds a single int.
Non-PODness is due to virtual members.
 
well you don't need to destroy such things
 
6:25 PM
Ok, thanks.
 
but i don't understand why you are doing placement new etc.
 
Don't worry, I just didn't want to complicate a code example with cleanup. It's not going into real code.
 
Oh, I see we've had an vigilante flagging old stuff here. Great.
 
@RMartinhoFernandes Removing 4-month-old chat messages makes perfect sense, can't you see it?
 
6:36 PM
at least you weren't here at the time
it was pretty bad
 
sbi
@balpha That answer has more downvotes than the answer saying the opposites has upvotes. This is still an open discussion, despite a loud minority trying to force their opinion on the majority. What's been stamped as bad language in such discussions here is invariably what North-Americans consider bad, and what's considered not bad is what they consider not bad. That is wrong. I have, I do, and I will object to that.
Also, I have actually worked in the US, and I know this is all false pretense. They all swear on a daily base, and they all know that they do, they just pretend they don't.
2
And you see the results: A respectable regular of the community banned for a while for an out-of-context vote on something he has said half a year ago, to which nobody who was here objected. That is so stupid, it makes my toenails curl up in disgust.
4
You might just as well ask the mullahs for what's allowed here.
2
 
Gosh, how annoying it is to have people answer your question without taking care to read it.
Maybe I put too much effort into questions.
 
hi fellows
anybody familiar with callback functions in C?
 
@RMartinhoFernandes - I have a suspicion the answer to your question lies in the platforms that boost::interprocess supports
@Ahmet - you want to call a non-static member function for one?
 
i want to create callback function on the go
like i did in back in jquery and javascript
for example
func ( &( void() { return 5; } ) )
is this possible?
func function gets Pointer for the callback function in the first parameter
 
6:52 PM
it is in C++0x
 
In C++11 you can have lambda functions, but I doubt they can have C linkage to make that truly a C callback
 
not in C++03
@awoodland They can- if they are stateless, they can implicitly convert to a function pointer of appropriate signature
 
C++ is ok too how can i do it in C++
 
@DeadMG i'm not so sure it's ok in C++11. because the callback needs to be extern "C". for example, a static member function isn't.
 
he was showing a lambda in his idealized syntax
and secondly, a function pointer is a function pointer- regardless of where you got it from
 
6:54 PM
@DeadMG no
 
@DeadMG - no, it can have different linkage
 
in C++11, you can do func( []() { return 5; } );
really? cause those WinAPI functions always took my static member functions just fine
 
most platforms do
 
i guess i gotta google that Lambda thingy
thank you fellows :)
 
6:55 PM
@DeadMG in practice it works in Windows. some compilers on other systems complain though.
 
I have never even heard of function pointer linkage
as far as I know, a function pointer is a pointer, like an int pointer is a pointer and if it points to an int on the heap or one on the stack of a member function or an argument or anything it's all the same
 
just google the term :-)
 
yep .) i already find some articles by googling lambda function callbacks :)
thank you :)
 
@DeadMG - last chunk of en.wikipedia.org/wiki/…
 
interesting
like a calling convention thing, then
 
6:59 PM
yeah
 
@awoodland That Sun CC again... :-)
 
how do you implement observer pattern?
i mean , the common interface to objects
all observers
 
So, can you declare extern "C" lambdas?
 
lambdas have C linkage?
 
No. Hence the question.
 
7:08 PM
grins
 
@RMartinhoFernandes I don't see why not.
 
What's the syntax? extern "C" []{}?
 
That's an expression, not a declarator or what not.
extern "C" auto lambda = [] {};
> main.cpp:1:17: warning: 'lambda' initialized and declared 'extern' [enabled by default
What an odd warning.
 
0
Q: Can a lambda have extern "C" linkage?

awoodlandThis seems to work on the platforms I have tried: #include <iostream> // extern "C" linkage extern "C" void foo(void (*fn_ptr)(int)); namespace { struct bar { static void f(int); }; } int main() { // Usually works on most platforms, not guaranteed though: foo(bar::f); // ...

 
@awoodland Why would the lambda need any kind of linkage to make this safe?
 
7:18 PM
@luc why did the static member need it?
 
I don't see why it should.
 
@luc - see the note at the bottom of 33.2: parashift.com/c++-faq-lite/pointers-to-members.html#faq-33.2
 
f is not a member function.
Neither is a lambda.
Let me double check, I think I may be able to debunk some things for this note.
 
"Note: .... pointers-to-static-member-functions are usually type-compatible with regular pointers-to-functions. However, although it probably works on most compilers, it actually would have to be an extern "C" non-member function to be correct, since "C linkage" doesn't only cover things like name mangling, but also calling conventions, which might be different between C and C++. "
 
Well rather, I think you should take this note as practical advice. I don't think it makes any sense from the language point of view.
 
7:24 PM
@luc - that was my plan and I have done so in the past, I was just curious about the official position with lambda functions too
 
> Two function types with different language linkages are distinct types even if they are otherwise identical.
I wonder if this one of those situations where extern "C" declarator here; vs extern "C" { declarators here; } make a difference.
I think Nicol's answer is final.
 
looking at the rest of 7.5 it seems that even putting the lamda inside extern "C" { } could still have C++ linkage
since I assume lambdas aren't exempted from "The default language linkage of all function types,
function names, and variable names is C++"
 
i don't think you can change the type of the pointer that lambda object converts to, by declaring the object itself as extern "C".
 
> Linkage from C++ to objects defined in other languages and to objects defined in C++ from other languages is implementation-defined and language-dependent. Only where the object layout strategies of two language implementations are similar enough can such linkage be achieved.
GCC will happily do function_type* p = [] {};, assuming extern "C" typedef function_type();.
I have no idea what to make of this.
 
7:46 PM
I think GCC is just being liberal.
 
7:59 PM
@awoodland Aberystwyth that's a town I've never heard of
 

« first day (323 days earlier)      last day (4618 days later) »