« first day (174 days earlier)      last day (5000 days later) » 

00:08
Oh hai there.
@thecoshman It's no different from any other word -- capitalize it at the beginning of a sentence and such, but otherwise, no.
reasons why I don't like ternary statement ideone.com/PHa7o god that looks ugly
@JerryCoffin I mean to say they should always start with a lower case letter
00:22
@JerryCoffin yeah, I am talking about code :S not sure if your where being sarcastic or not there
00:53
Oh, you mean the name of a variable? The C++ standard has nothing to say about that, but capitalizing member variables would be fairly unusual.
01:30
I starting to think that writing my own makefiles will be quicker than trying to get CMake and Qt to work together in order to build a Windows binary on a Linux machine.
4
Q: Calling function template specialization using C calling conventions

Johannes Schaub - litbI have the following template template<typename T> void f(T t) { } And I want to pass the address of a specific specialization of it to a C function g(&f<int>); But as I want to be portable, I want the calling convention of "f" to match the one of C. So I experimented how la...

02:16
is U.S. not active on this chat? seems to be most populated during West-European day time...
@StackedCrooked The US has some representation (James and I, for a couple of obvious ones). Maybe we're less talkative...
We're too busy being awesome Americans.
02:54
@GMan I can imagine that occupies much of your time :)
I don't know about others, but I've been too busy recovering from the Stack Overflow meetup.
Was that today? Cool
Yesterday.
Many C++ developers there?
No fewer than five.
From the Seattle #SOMeetup: @JamesMcNellis, @GManNickG, @JaredPar, Michael Burr, and Martin (@LokiAstari). http://twitpic.com/4hzf2u
02:58
@JamesMcNellis Nice!
03:48
I know what I'll do to get myself answering again: one drink per up-vote, no drinks otherwise.
cpx
cpx
How come some people have their reputation score turned off while in chat?
@GMan So that's how you're supposed to do it. I should try this as well...
@cpx Because it's embarrassing?
I should probably sleep soon, it being 6 AM and all..
cpx
cpx
04:04
@StackedCrooked not sure
@cpx I'm also not sure..
anyone up to help with my Q?
0
Q: help with linked list template

kingcong3I need some help with my linked list. I think the problem is in the copy constructor or the assignment overload. it keeps giving my segmentation fault when i call: (Queue test_int_copy(test_int);) Any other error or poor implementation that you can see would also be very helpful. the .h file #...

My review of One Piece: boobs +1; snot -1; verdict: undecided
04:22
hey stacked crooked
thanks for answering the Q
do u see anything else wrong with my code??
i am still getting an Segmentation fault, from the copy constructor??
@kingcong3 avoid declarations without initialization:
ListNode *previousNode;
previousNode = NULL;
You should do this instead:
ListNode * previousNode = NULL;
That's more a style hint, sorry. I'll have another look tomorrow...
all of these stuff should cause error tho right??
just style??
@kingcong3 it's an error if you would try to derefence a pointer to an uninitialized pointer. For example;
int * a;
*a; // CRASH!!
And in your code this maybe happens...
O ok i'll go through an check for these
@kingcong3 You can also find the error using a debugger? Are you using Visual Studio?
04:32
thanks again
no
im in putty
linux?
idk
Then you can use gdb.
Launch your program like this: gdb MyProgram
and then in the GDB console type: r
(gdb) r
Starting program: /home/st/trinhc/cs250/b.out
Test 1 Constructor
Test 2 Push

Program received signal SIGSEGV, Segmentation fault.
0x0000000000400dda in Queue<int>::enqueue(int const&) ()
(gdb)
And it will start your program and break on the error. The you can type: bt full. It will display the stack trace.
@kingcong3 Ha! It's the enqueue method apparently.
so the error is in enqueue?
o
cool
i wish my teach would show me this stufff....
@kingcong3 Try to find out exactly which line is causing the error.
04:35
stackoverflow > teacher
Did you compile with -g? It should've pinpointed that more exactly.
@PiotrLegnica good point.
how do i get out of gdb??
@kingcong3 type "Ctrl-C" followed by 'q'
and ENTEr
the teach told me to edit the bash
to alias g++='g++ -ansi -pedantic -Wall -Werror'
so i run g++ queuetest.cpp - o test.out
and run the test.out file
so i guess i am not using -g?
04:39
@kingcong3: also this:

if(previousNode->next == NULL) { … }

can be typed shorted like this:

if (!previousNode->next) { … }
@kingcong3: "-Wall -Werror" is good! , but for gdb you need to also add "-ggdb"
ya i knew that, but i got disprit so i just started trying everything
@kingcong3 yeah, disprit does that
so edit my bash in alias g++='g++ -ansi -pedantic -Wall -Werror -ggbd'
??
would help me with debugging??
@kingcong3: yes that would help.
cool thanks, i'll go through it again with the new debug
good night and thanks for the help stackedcrooked
04:42
@kingcong3 the "ggdb" option generates more debugging symbols for gdb. In your particaluar case it's possible that it won't really make a difference though...
Could it be because of the head being null in the enqueue @kingcong3
it runs if(isEmpty()){
head = newNode;
return true;
}
Well, if a pointer is not initialized, will it be set to 0 automaticaly?
Or something like undefined behavior
if I look at isEmpty, I can see that it only test for head to be different from 0
Btw: this is Justin Bieber with no eyes: i.imgur.com/ZS98u.png
04:47
lol
how would i run with -g??
its tell me nodePtr = nodePtr->next; is causing the error
@kingcong3: -ggdb generates more debug info than -g
@kingcong3 That probably means that nodePtr is a dangling pointer
i should have majored in philosophy instead...
haha
shit is pissing me off
Would you mind to try to initialize your head pointer in your copy constructor please @kingcong3? I'd try to set it to null.
ya
i edited the code
like 5 sec ago
and it still doesn't work?
04:53
no
still Segmentation fault
i edited the code on the page too
By the way, you should avoid having multiple return in a single function
the IsEmpty could be changed to return !head;
I only see head = NULL in the constructor, is it because I don't have the latest version?
no
is there something missing?
In your copy constructor
head should be set to null there too.
son of a bitch
good catch
that makes sense
does it fix the bug?
you should probably do it to in your operator= function
05:04
hold on i fucked something up so i cant compile
haha
FUCK YES!
haha
cool thanks a ton man
You are welcome :)
don't forget to close your question (and upvote my answer at the same time hahaha, I am so greedy)
And if I can give you some additionnal tips, try to avoid multiple return in a single function. I know that sometime it can help readability, but most of the time it only makes your code spaghetti-like.
Spaghetti code is a pejorative term for source code that has a complex and tangled control structure, especially one using many GOTOs, exceptions, threads, or other "unstructured" branching constructs. It is named such because program flow tends to look like a bowl of spaghetti, i.e. twisted and tangled. Spaghetti code can be caused by several factors, including inexperienced programmers and a complex program which has been continuously modified over a long life cycle. Structured programming greatly decreased the incidence of spaghetti code. Examples Below is what would be considered...
05:14
cool will do
but one thing
u said to set the head = NULL in the assign too
thats false right??
yes
?
What do you mean?
doesnt the assign to through and delete everything then enqueue?
or is it better to just set it to null
Can I ask you what happen if you assing your class to itself?
ahh ic
I think you will lose everything
you should test for self assignement
05:20
no that makes sense
the teacher was telling us to delete than enqueue
@kingcong3 Use the copy-and-swap idiom; be correct, succinct, and done.
2
+1 @GMan
will do
warning: control reaches end of non-void function
does that mean i need to return something??
what is the method signature?
Queue<Object>& Queue<Object>::operator =(const Queue<Object> &rhs)
{
head = NULL;
ListNode *nodePtr = rhs.head;
while (nodePtr!=NULL){
enqueue(nodePtr->obj);
nodePtr = nodePtr->next;
}
}
05:28
That function is suppose to return a reference to a Queue<Object>...but you are returning nothing.
Assignment operators canonically return *this;, a reference to the assigned object.
even when i try return this
o
its return *this
Yeah. For historic reasons, this is a pointer, not a reference (like it should be).
i love u guys <3
<3
<3 :)
05:33
:| Fancy pants eh.
       @@@@@@           @@@@@@
      @@@@@@@@@@       @@@@@@@@@@
    @@@@@@@@@@@@@@   @@@@@@@@@@@@@@
  @@@@@@@@@@@@@@@@@ @@@@@@@@@@@@@@@@@
 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
  @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
   @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
    @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
      @@@@@@@@@@@@@@@@@@@@@@@@@@@
        @@@@@@@@@@@@@@@@@@@@@@@
Hahahah
The chat room is filling with love
Oh good, @jalf is here to help. Give us your best.
@FredOverflow: Did you go to a Stack Overflow meetup?
Love is in the air tonight
wow, this guy is wearing a t-shirt with a wolf on it
winning, anyone?
05:38
lol. We should get back on topic.
yeah, probably
What is this "on topic" of which you speak?
Trying to justify the error in this:
2
Q: Why is this rvalue call ambiguous?

acidzombie24Why is this rvalue call ambiguous? I can have AA and AA& and the compiler will know to use AA&. But when i add in the third option i get an error. Obviously AA&& is a better overload then the others like int for an int is better then long. Why is this ambiguous? Is there a way i c...

05:52
@JamesMcNellis Nope, no time, no money.
@FredOverflow :(
Plus I'm not an American :)
The meetings were in America, right?
@FredOverflow They were world-wide, AFAIK.
@FredOverflow There was one in Berlin, which to the best of my knowledge is not in America.
@tina Hello.
@tina I'm well, thanks.
06:05
@tina Are you talking about en.wikipedia.org/wiki/Hidden_Markov_model ?
We are currently talking about it in my AI course, but I am far from being an expert about it. :S
bye
cpx
cpx
Although my gravatar used to be random on each day. I'm liking this fixed one I have.
06:30
drahak u still there??
Gman are U still there?
no
lol
i wanna talk to u
i need your help with this wield error
but, but
@kingcong3 you look like someone who is trying to finish an assingment hahaha
o
lol
dude drahak i need your insight on this little thing
its something small thats fucking up my code
i coded out everything excpect this lines
#ifndef STACK_H
#define STACK_H

template <class Object>
class Stack
{
}

#endif // STACK_H
#include "stack.cpp"
I'm affraid I can't do that @tina
#include <iostream>
using namespace std;

template <class Object>
haha
no you didn't it's a movie quote
with tina instead of Dave
06:42
stack.cpp:4: error: expected unqualified-id at end of input
i had it working before but when i was cleaning up the code, i fucked something up
eh, don't include a .cpp
@kinkcong3
ya the teacher wants us too
idk y
Are you realy sure?
ya
shes kinda dumb
Will you lose a lot of point if you do not do it that way?
06:46
idk its the first assginment. i dont think its the error tho since i do with the queue too
.h don't get compiled
.cpp does
the only reason your code is compiling right now, is because you are including your .h in your main.cpp, which will be compiled
ya
shes dumb
i was told that the .cpp should include the .h not the other way around
By including you .cpp in your .h, you will have to recompile the entire project everytime, because nothing is compiled in .cpp and everything is done in the main.cpp
very wrong
please, fight for this, don't let this happen
about your problem, you can't just declare template <class Object> in a .cpp
it must be followed by a function declaration or a class declaration
template <class T>
class X
{};
template <class T>
int foo() {}
template <class Object>
Stack<Object>::Stack(int size)
{

}
its really this
im going to ask a question with the full code
its really wield
i dont get it
it occurs on a everytime i code somethingStack<Object>::Stack(const Stack& a_stack)
what is HMM?
06:52
Stack<Object>::Stack(int size)
.... only one Q per 20mins
If anyone here needs to stay awake for some reason, let me know. I can help.
@StackedCrooked What will you do&
Suddenly you will hear someone knocking on your door ... with an AXE!
No, just kidding.
I have a good audiostream that helps me stay awake, so I would simply give you the url.
07:08
OMG its been 20 mins
let me post
!!!!!
Drahak, if i send u the files can u see what is wrong with it??
its a small thing that i need fresh eye to find
@StackedCrooked yeah I'd like to have it
o wow i just got it
i feel dumb
@kingcong3 sorry man, you'll have to wait SO let you post
i hate computer science because it makes me fell retarded
07:15
@StackedCrooked it's pretty cool actualy!
@Drahakar Keep listening, it gets better ;)
@kingcong3 I understand that it can be pretty hard when you begin, but once you get the basics right, the rest is pure fun and creativity.
@StackedCrooked who's the artist?
Belgian Dj called Murdock
07:47
good night all
sbi
sbi
@StackedCrooked For heaven's sake! ListNode *previousNode; is a definition! (However, ListNode * previousNode = NULL; is indeed superior.)
@Drahakar In the chat, that's done via starring.
@FredOverflow We were a dozen in Berlin. (That included one guy who came from Dresden, because he was the only one there.)
@kingcong3 If you properly @address other users, they'll be pinged for you.
@sbi around here it's called a declaration. It's a local thing.
@sbi you catching up with all missed messages?
sbi
sbi
@kingcong3 And that's the way it should be. You, however, where doing the opposite.
Hint: It's usually the students who are dumb, not the teacher. Exceptions exist, but they are rarer than students like to believe.
@sbi forgive, I'm trolling ;)
07:49
suddenly a barrage of messages to different people
sbi
sbi
@Tony Yup. Had another "let's have a beer tonight" night, got to bed late, and got up late. Now need to take a shower, and go to work.
@StackedCrooked It's alright. I already plonked you. :)
@sbi you've a pretty flexi schedule then....
@StackedCrooked what do you mean "It's a local thing"? Where you are you have your own version of a global standard? A deceleration will set some value to a variable or function. Although close, a definition is not the same as a deceleration
sbi
sbi
@Tony I think I need to be in from 11-4. But if I have some appointment during the day, I just need to tell. The idea is to be able to schedule meetings in that time without having to ask everyone when they'll be in, not to bind us to our chairs.
@thecoshman Yeah, here we do things differently. Got a problem with that?
sbi
sbi
07:53
Anyway, I really do need to get out of the door. I'll be back in 60-90mins.
See you!
@sbi my lecture a couple of weeks ago (I hope this was just a brain fart) was talking about the view frustum, and said, "what ever shape that is in maths" my instant response was "erm... a frustum?"
@StackedCrooked honestly, yes kind of. What is the point in having a standard, if people are just going to make up their own version of it?
I appreciate that this is a small and rather trivial point. But if we (as a community) agree what the basics are, how can we talk about the most abstract notions?
08:06
Weekend!
2
@PiotrLegnica +1 :)
@PiotrLegnica not for me. Dissertation to finish writing today, then weekend is spent making my code look half respectful
 
1 hour later…
09:20
I've never seen the use of operator like this, what is it trying to do?
 W2A(_bstr_t(bstrVar).operator wchar_t*());
@GMan That can be quite harmful for the liver of someone with 60k+ rep... How many would you have to have? 5000 drinks (being conservative)?
@Tony that is an explicit call to the implicit conversion to wchar_t*
@DavidRodríguezdribeas is that considered "good practice"?
Do you have another option? I mean, the use of an explicit operator might be dictated by need more than by taste
@DavidRodríguezdribeas I'm not sure if there is another option, but I didn't write the code. I just have to rewrite it without the COM part
I.e. imagine that two classes A and B can be implicitly converted to each other in more than one way: A::A( B const & ), B::operator A(), then having an implicit conversion will trigger an ambiguity error: (A)B() the compiler cannot determine which of the two conversions to use, but you could disambiguate by explicitly selecting the path: A( B() ) -- use A::A(B const& ), or B().operator A()
I would avoid doing it, then if the compiler barfs, go back and try to solve it
09:27
And invoking the operator explicitly is perhaps deemed better practice than resorting to a reinterpret or c cast
W2A(_bstr_t(bstrVar)); // might be ambiguous
W2A( (LPCWSTR)_bstr_t(bstrVar) ); // might be considered bad practice
@ChrisBecke That's right, it might also be ambiguous if W2A has more than one overload, not only the conversion can be ambiguous
I do personally think that using wchar_t is the worse part of that statement. wchar_t is not guaranteed to be the same size as WCHAR, or OLECHAR which is what a BSTR is.
@ChrisBecke That is a bad practice, the problem is that you have lost control of the conversion there, and if someone changes something somewhere (some*), it might turn from a static_cast<> into a reinterpret_cast<> with UB
likewise, LONG should be used in place of long in Winapi code, as long is 64bits on some compilers, but LONG is 32bits under both Win64 and Win32 APIs
@DavidRodríguezdribeas so then, W2A( _bstr_t(bstrVar).operator LPCWSTR()); might be considered best practice, except for one small thing. bstrVar looks like its a BSTR value, which is, already, a WCHAR*
so
W2A( bstrVar );
W2A is presumably a Wide-To-Ansi function
sbi
sbi
@PiotrLegnica Aren't you in my TZ? Here we have another day to go...
09:41
Of course, Windows NT is natively unicode, so it means that, as soon as you make any API call, the OS has to do the reverse: A2W() on every string passed as a parameter.
If you can, convert the app to unicode and just skip the W2A step entirely.
@ChrisBecke I'm abandoning all COM so I won't be using W2A anymore, cause per what I read it is prone to stack overflows under certain circumstances
sbi
sbi
@Tony Declaring implicit conversion operators/constructors is usually considered bad practice in C++. (That's why there's the explicit std::string__c_str(), after all.) I have certainly been bitten and learned to shy away from them the hard way. Once they are defined, however, using them explicitly I wouldn't call that much of a sin.
1. removing the BSTR then, and just storing the var in a std::wstring or std::string? good plan
2. stack overflow??? what situations?
@ChrisBecke it's in combination with USES_CONVERSION macro
sbi
sbi
What is this code (W2A(_bstr_t(bstrVar).operator wchar_t*())) supposed to do anyway? Wouldn't the bstr prefix to bstrVar mean that it already is a _bstr_t? (And, by inference, that bstrVar is an exceptionally bad variable name.)
09:46
bstrVar would be a BSTR.
@sbi this is just generally awful code that I'm doing a rewrite of....
it is a BSTR
_bstr_t is a compiler generated auto_ptr that wraps a BSTR
sbi
sbi
@ChrisBecke Lemme guess: BSTR is a sibling to LPWSTR, and _b_str a sibling of boost::shared_array?
something like that.
no
BSTR is a type of wide string in Windows that has specific allocation and de-allocation functions, it's length-prefixed
and _b_str is going to be just a wchar_t* typedef, I'd expect

« first day (174 days earlier)      last day (5000 days later) »