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

16:00
lol
16:18
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.
16:21
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.
16:24
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.
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?
16:31
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!
@LucDanton hi
Als
Als
hmm
16:40
ohla @Als
Als
Als
hola back at you @TonyTheTiger
ahh work day tommorow...
how are ya?
yes, work day, if you have work
Als
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
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.
16:45
hahah
So, almost every job ever?
basically yes
Oh, sorry, misread.
oh like i c++
Als
Als
@MrAnubis: What does that have to do with what is work? :P
16:46
i do at home
Als
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
Als
@TonyTheTiger: Uh...Impressive, I can never relate, things here in chat
16:48
i student
Als
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.
16:49
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
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
Als
16:51
@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
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
Als
16:53
@AlfPSteinbach: Doesn't show me!
video for me?
@Als That's because nobody's taken the time yet to process the incoming messages.
Als
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
16:55
@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
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
16:57
@AlfPSteinbach : can you answer me too?
Als
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
Als
okay folks, need to move out. have a good time. see ya around.
17:01
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?
17:16
@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
17:24
here is night , going to sleep)
Europe ?
Nepal
you're indian seems like from name
are you?\
Yup
17:27
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
17:30
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.
@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.
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 :)
17:36
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?
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?
17:39
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.
17:40
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
17:42
@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);.
17:51
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?
18:03
@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
18:05
@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...
18:17
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.
18:21
There is nothing to clean up.
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
18:25
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?
18:36
at least you weren't here at the time
it was pretty bad
sbi
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
18:52
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
18:54
@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 :)
18:55
@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
18:59
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.
19:08
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?
19:18
@luc why did the static member need it?
I don't see why it should.
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.
19:24
@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.
19:46
I think GCC is just being liberal.
19:59
@awoodland Aberystwyth that's a town I've never heard of

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