« first day (370 days earlier)      last day (4571 days later) » 

7:00 PM
So I have to overload operators
right now I have the list ordered by one member with this overloading:
bool operator < (const filmType & a, const filmType & b)
{
return (strcmp(a.number, b.number) < 0);
}
Number is the front most member in my struct
but in my list it is not unique
 
Why are you using char*.
 
there are other a.number memebrs in other structs in this list that are the same
so the 2nd member "copy"
 
Why is string called "number".
 
Is what I want to append the end of number with to ensure my sort works on duplicate numbers
 
Also, entire code, or this will take forever.
 
7:02 PM
@CatPlusPlus Evening
 
@ManofOneWay Sup.
 
should the return value of operator= be the class itself?
 
No, the reference to it.
 
@CatPlusPlus Are you studying?
 
@ManofOneWay Right now? No.
Unless you mean something else.
 
7:03 PM
That's what I meant =)
 
@TonyTheLion T& operator=(T other) { swap swap swap; return *this; }
 
my class has a raw pointer though, so no swapping I guess
 
So? You should handle this in the copy ctor anyway.
After a copy, other should be perfectly swappable with *this.
You will either copy a pointer (if it's not a dynamic resource, or something) directly, or do a deep copy.
And if you have a dynamic resource and not doing deep copy, then your class is already misbehaving on copying, so why are you writing operator= instead of fixing bugs. :P
 
yes copy ctor handles pointer
so just std::swap(*this, other)?
 
With ADL. using std::swap; swap(*this, other);
Well, probably even without std::swap, since you need your own swap anyway.
 
7:23 PM
hmmm
if I copy a const char * str into a char *, should I use std::copy or strncpy?
 
That depends, in part, on what the destination char buffer's formatting is supposed to be.
If it's supposed to be null-terminated, I'd probably just use strncpy
 
yes null terminated
 
Because it's easier (less code) to use strncpyin that case when you know the size of the destination buffer than trying to use copy with iterators offset in terms of the destination budffer size.
^ My opinion
 
hmmm
should the length of the source string be strlen(str) + 1 ?
 
Also consider that if you use copy with iterators in a string, you won't get the null terminator -- you'll just get the goodies
 
7:27 PM
sure, but I'm copying char *
not std::string's
 
Oh, right.
Yes, strlen(s)+1
Honestly though, I'd probably *really* do something closer to this:
#include <memory>

int main()
{
const char* str = "Hello, foo.";
char out_buf[256] = {}; // this gives me the null-terminator
memcpy(out_buf, str, strlen(str));
}
 
I don't think I've touched pointers since I made that practice data structure library... Just references, really.
 
char* is evil.
 
yea, but I'm just playing around with stuff, so it can be evil, I don't mind
 
char* isn't Evil. Doing stupid stuff with it is.
 
7:44 PM
ok, I just implemented a simple string class of my own, but I'm not sure of how I'd make the operator= work, anybody care to have a look. Comments are welcome!
 
@TonyTheLion Do the same thing you're doing in the constructor. Just remember to delete[] the old C string.
 
@Maxpm why would I want to delete the old one, it's just an assignment, which is essentially a copy, so the original stays no?
 
@TonyTheLion Let's say I have a tony::string that holds "Hello, world!". That's 14 characters (including the \0), so it would be allocated in your constructor with new char[14].
 
No, just swap the pointers.
 
Now if I want to assign "This is a test of strings." to that tony::string, the inner C-string will not have enough space allocated to hold the entire message.
 
7:53 PM
The copy will own the old buffer, and will get subsequently destroyed as an automatic variable.
 
meh
two people trying to tell me two different things, I'm confused
 
To be honest, I'm not really sure what @CatPlusPlus is talking about.
C string functions are not my forte.
 
@CatPlusPlus assignment is copy operation though, so not sure how swapping pointers will deal with that?
 
Wait a sec.
 
I'm not too familiar with the math behind the fourier transform but I'm trying to use spectral synthesis to make terrain. I've got my algorithm down in mathematica but I can't find a way to take the inverse fourier of a 2d array in C++
I'm thinking to use FFTW but I'm not sure how to use it to take the inverse fourier
 
8:06 PM
@TonyTheLion ideone.com/KhvJz There you go.
Now, the splainin'. What @Maxpm said would be relevant if you had operator= that takes const char* directly.
But you don't, so all char*s are being wrapped up by the implicit conversion before the operator= even starts.
Now when you make a copy, you do a deep copy of the pointer (i.e. you create a new buffer, and copy the contents over).
That means both the original and the copy are valid objects, with invariants intact, after the copy. That's good.
Now you have assignment. It has T& operator=(T) signature — it takes a string instance by value.
Which means a copy will be made (let's forget about copy ellision), so you've got valid, but temporary automatic object with the string you want to assign to the current instance.
The buffer in the current instance you want to get rid of. So what do you do? You swap the pointers.
Now the current instance is the string you wanted, and the other object has the old buffer.
operator= returns, destroying the other object (and by extension, the old buffer), and you've got perfectly new string ready to be used.
(You've got a bug in your previous code — default ctor doesn't initialise the field properly, so it segfaults after the swap.)
(ideone.com/xqSEm — main with less noise, so it's more visible what actually happens.)
Am I making sense, or is nonsense coming out of this?
I see everyone died.
 
yea it's making sense
why would you want to get rid of the current instance in case of assignment operator?
that's where I'm confused I think
 
@ManofOneWay - hi
(was afk)
 
You assign Y to X. X has a buffer allocated, so you need take care of that. You could try to copy the characters from one buffer to another, but as has been pointed out before, the sizes likely won't match up. So, the easiest way is to just use the already allocated buffer in Y, and throw away the one in X.
 
oh but I'm just assuming that Y has nothing in it yet
that's where my mistake lies
 
Well, unless it doesn't have a buffer allocated, but then it's handled by the fact that delete[] doesn't do anything bad when it gets NULL.
So you don't have to special-case it or anything. Less code, less bugs.
 
8:21 PM
cool, well this was fun
 
8:37 PM
I just got home and it's 22:30 already. :/
Meh. Back to the silly GL window.
I need to do some text rendering.
 
@MSalters @PaulR @RaymondChen @BookOfZeus, @McDowell:
-2
Q: Windev16.exe Has Stopped Working on Windows 7

this is the problem which I am facing on windows 7 for windev16 Please Help Me Thanks

17
A: Why was this question closed as off-topic without being migrated?

Jeff AtwoodWhat's the golden rule of question migrations? Don't. Migrate. Crap. Guess what I thought that question was? Go on, guess!

 
@Tom: Was that your question?
 
You are aware that none of these people are in this room, right?
 
@JohnDibling Read Jeff's response. And no, my username is equivalent across the network.
 
Chat doesn't notify people that hasn't ever been here, or hasn't been for a long time.
 
8:42 PM
@TomWijsman your name sounds Dutch, are you Dutch?
 
@CatPlusPlus Yes, I do... If you have any better room or way of contacting, feel free to share.
@TonyTheLion Yes.
 
Well, this way you won't contact them at all.
 
@CatPlusPlus It does for moderators, but I'm not one so well. I'm just leaving a note...
 
So, any other way, really.
 
@TomWijsman me Belgian, from the Flemish part :P
 
8:43 PM
@CatPlusPlus This is my best bet, though...
@TonyTheLion Same here.
 
Also, who cares.
 
oh wow, nice to know :)
@CatPlusPlus no one, this is the internet :P
 
Doesn't seem to be closed on the other side.
Also none of these people are mods.
 
It will be soon enough. The rate of closing on Super User is different from Stack Overflow.
 
8:45 PM
Again, who cares.
 
You?
 
Not a single fuck was given that day. :P
 
Not really, no.
 
I do care about shouting at person who wrote VS Version Selector crap.
It doeeesssn't wwoooooooooooooooooooooork.
 
8:46 PM
oh shit
 
It works for me.
But well, I'm leaving now as I'm more of a C# person...
 
oh lulz
nice to meet another Belgian
:)
 
Okay, FreeType. We meet again.
 
i have a really noobish c++ pointer question but here it goes...how can i set an int to a int that a pointer is pointing to ex... int *x; .... int b = x;
 
int b = *x;
 
8:48 PM
template<typename T> struct D{ func(T a){}}; //func is not dependent here , right?
 
you need to dereference x so you get it's value to put into b
@MrAnubis no, func is not dependent, but it's arg is
 
@TonyTheLion thanks for quick help:)
 
no probs
 
If you could have one major improvement for std::vector... what would it be?
 
Getting rid of vector<bool>.
 
8:52 PM
@CatPlusPlus What's the problem with it?
 
it's silly
 
It specialises vector to use bitmap, whether you want that, or not.
 
bitmap?
 
Bitvector, if you prefer.
 
oh
I see
and you want a real bool instead?
 
8:54 PM
Any other improvements for std::vector?
 
Yeah, we've got bitset and dynamic_bitset for bitmaps, if you need them.
Specialisation is uncondtional, so if you want a vector of bytes, you need vector<char>, and that's not intuitive when you want to store logical values.
I can't come up with anything else, really.
 
@JohannesSchaublitb How are you?
 
im fine. how are you?
 
I'm fine thank you
Studying too much though :(
What are you up to?
 
9:02 PM
ohh
im doing hard work xD
 
watching ascii-pr0n?
:D
 
lulz
doing lazy stuff. chattin
IRC
USENET
 
any easy way to show the bit representation of an unsigned
 
Not this guy.
 
9:10 PM
It's minus degrees here now on the nights :(
 
He's everywhere lately.
 
yea true
 
I need to wrap my head around GL coordinate system once and for all.
 
Are you guys making some cool spare-time projects?
@CatPlusPlus :D What are you stuck on?
 
@CatPlusPlus that opengl?
 
9:14 PM
Hi guys, just a quickie, does anyone know why getline() seems to stop reading when it finds a space character, even tho i deliberately used the overload with a delimiter, which i set to '\n'?
 
I am using the MSVC compiler, if that is of any importance
 
@ManofOneWay That bloody W coordinate gets me every time.
 
Is the destination buffer large enough?
 
@Drknezz that is the default delimiter, have you tried setting it to ' ' (ie an actual space)
 
9:19 PM
@user392858 the buffer is a std::string
@TonyTheLion according to en.cppreference.com/w/cpp/string/basic_string/getline, doing that would effectively make getline stop at the first ' ' space found, which is not what i want.
 
@Drknezz You're using cin.getline or std::getline()?
Ah, std::getline.
 
@RMartinhoFernandes std::getline with cin as the stream parameter
 
@Drknezz oh right
wasn't sure what you wanted
 
std::getline(std::cin, line); should read to the end of line already.
No need to make the delimiter explicit.
 
@CatPlusPlus I don't find a W coordinate anywhere
OpenGL uses a right handed coordinate system by default
 
9:22 PM
Clip space is 4D.
 
@RMartinhoFernandes It reads "this" into the string from "this is an example
 
Actual code, and input, on ideone. Otherwise we can only guess.
 
0
Q: ICustomMarshaler variable length array

XaadeI know one can use an index into an array to specify length of the array for a marshaled C-array. However, I would like to do it a little different. I would like the size to be a prefixed Int16. If I make it an entry of the array, I can't control the marshaled size of the count specifier. So, i...

 
Will do
 
@TonyTheLion That I know.
 
9:23 PM
> Clip Coordinate X, Y, and Z are divided by Clip Coordinate W to produce Normalized Device Coordinates.
this help?
 
@CatPlusPlus The use of it is described here en.wikipedia.org/wiki/Homogeneous_coordinates
 
I want Y axis flipped, and units matching window pixels, anyway.
 
What @ManofOneWay linked to.
 
I know where it's used, I have a trouble picturing it in my mind.
 
lol, well, it helps if you understand it first, and then you can picture it or try, lol
 
9:24 PM
It's easier to picture the homogeneous 2D space (the one with three dimensions).
 
what's all this homogeneous about anyways? That wiki article is too difficult
for a non maths person such as myself
 
@CatPlusPlus Weird, the exact same function works quite alright in IDEOne, but not in my app
 
Yes, 2D I can now see.
 
So, 3D is the same principle.
Just hard to imagine.
 
9:27 PM
A point is a line through planes.
Yeah.
Hard is an understatement, really.
 
@TonyTheLion It's a property of functions.
And vector spaces.
 
well, 4D would be hard to imagine I guess in a 3D world
 
It's not easy to explain without some math background.
 
4D is fucking magic.
 
9:28 PM
@RMartinhoFernandes hmmm well I have an idea about vector spaces, and I can think with functions
@CatPlusPlus most likely
 
I don't need to understand all the concepts perfectly, though, I just want to know where my vertices will end up. :P
 
just wikipedia always goes into to the whole riggamarole that you don't want to know
 
Is there a reason you need to use W != 1?
 
Now that you mention it, I probably won't.
 
9:30 PM
Just stick with it then :)
 
See, we're getting somewhere.
 
Let's make a cool f*ckin OpenGL project!
 
this seems interesting and not too hard : teamten.com/lawrence/graphics/homogeneous
 
I'm making a silly Tetris clone.
 
oh lol, that's what I tried to do
but I got confused, meh
 
9:31 PM
My goal is to make several silly, simple games, and then infer a framework out of them.
 
Let's make a cool 3d world with some rain. I like rain
 
hahah
 
And blocks.
 
come to Britain, rain plenty
though haven't seen any
 
And then you can craft stuff out of blocks.
 
9:31 PM
lately
 
Oh wait, that's Minecraft.
 
And mine. Let's call it Craftmine.
 
I went to London not too long ago, it was actually very nice weather! :)
 
I don't understand dogs.
 
9:32 PM
1 is such a cool number. Eh is neutral and doesn't afraid of anything.
 
Stupid bitch ate her own puppies.
 
@TonyTheLion I went to Fortnum & Mason. F*cking amazing!
Ever been there?
 
You can use u here.
We'll subtract it from the yearly quota.
Unless you ran out already, in which case, what the hell are you doing with your us.
Eating them?
 
@RMartinhoFernandes Come again?
 
@ManofOneWay We have a female dog (a bitch), and she gave birth recently.
Then she ate the puppies!
WTF man? I thought eating their own offspring was a thing of silly animals, like, non-mammals.
 
9:35 PM
Maybe she was afraid of zombies.
 
Sounds nasty
 
Or the lawyer called.
 
It's not like we forgot to feed her or something.
 
Now to flip that Y axis. Y axis going up is silly.
That's not how we do things around here, Y.
 
Y up is awesome
 
9:36 PM
Just set a projection with Y reversed.
 
@ManofOneWay no, where is it ?
 
Somewhere in the centre of london
Piccadilly
@CatPlusPlus Why is Y going up silly? Think of oldschool math, where you have a paper with X and Y axis, and then Z goes inside the paper. I do think it makes sense.
 
wow, looks nice
I'm in London tomo
perhaps I'll have time to pass by
 
You should visit, especially the third floor
 
9:40 PM
It's expensive though :(
 
Damn, looks like I can't boost.fusion my way out of this one :(
No algorithm to simulate a switch.
Or random access with runtime indices.
 
Arrgh, a bunch of recursive templates it is then.
No, wait, maybe I can coax fold to do this.
Good ole fold is always reliable.
 
@ManofOneWay Because screen coordinates are Y down since forever. Get off my lawn!
 
9:44 PM
I've always pined for Y-up whenever I used a Y-down system.
 
I love Y-down.
 
Will you marry her?
 
why is it that half of the pictures taken of me, I look like a full on dweeb?
 
Y not.
 
lulz
@CatPlusPlus is now married to Y
 
9:45 PM
@TonyTheLion I could come forth with an explanation, but I'm not sure you'll like it.
 
@RMartinhoFernandes oh lol, I could guess what it might be
:(
 
I'm not photogenic either, whatever that means exactly.
 
It means you don't look good on pictures
 
Thank you, Sherlock.
 
9:46 PM
I don't look good anywhere.
 
oh
@CatPlusPlus You're welcome, Watson!
 
That too, probably.
 
I look awesome
 
little bit of help :D
p is pointer to some class A (class A has overload operator [])
how to call operator[] with pointer p?
 
at least one not self loathing person
 
9:47 PM
I don't really care how I look.
 
@Srle (*p)[x].
 
jees I'm chocking in my own cough here
 
I hate myself for a myriad of different reasons already.
 
fuck me
 
Or p->operator[](x).
 
9:48 PM
ahh, thanks :)
 
@CatPlusPlus Why man? Think of the ladies
 
@ManofOneWay That's not helping.
 
what do the ladies care if you hate yourself?
 
One bit.
 
1
there you, one bit
 
Bloody optimist.
 
And the other one.
 
Then why do you hate yourself?
That doesn't sound healthy
 
I just don't like the way I look
 
He's a cat.
It should be obvious.
 
9:49 PM
I think I look too young for my age
and I'm just not all that good looking
 
@TonyTheLion Women seem to desire that property about themselves.
 
@RMartinhoFernandes but I ain't no women
 
That's a good point.
 
I'm a man, so I need to look good and old enough
lol
if you'd see me on a pic, you'd prob never think I'm 25
 
Oh, you're not that much older than me after all.
 
9:51 PM
I wonder if the rep on stack is helping, maybe some girls like that. What do you say @JohannesSchaublitb ?
 
The way you talk sometimes ("I'm older than you and (...)"), I thought you were like 30 or something.
 
Argh, I'm being swarmed with mosquitos.
 
what?
 
You'd think it's winter already and they should all die in fire. Or snow. Or whatever.
 
@RMartinhoFernandes I thought I'd told you my age before
@CatPlusPlus lol, I hate mosquitos
they suck
 
9:53 PM
Seriously, most girls like confidence the most. If you have confidence, you're fine.
 
@RMartinhoFernandes I didn't mean to sound like that, all old and know-best and shit
 
@TonyTheLion Hmm, maybe. I don't remember though :)
 
@CatPlusPlus What's the temperature over there?
 
I don't know. About 15.
 
9:55 PM
15? Really? It's 4 here
 
Where are you?
 
Stockholm, Sweden
 
The fridge?
Oh.
 
Almost
 
For me the year is made of two seasons, winter and not winter. It's not not winter anymore, so it must be winter.
 
9:55 PM
ohhh
 
Summer is about to end here.
 
may I ask you a question?
 
You already did.
 
You get one more
 
9:57 PM
owned
 
hahaha
le me is eating cheese
it's cold outside here, but where I'm sitting it's nice an warm :)
 
Yeah, that's the whole point of houses.
Protect you from the elements.
Like molybdenum and such.
No wait, maybe not those elements.
 
i'm still thinking about peepholes
 
So when are we having a C++ gathering? I thought we should meet up at the oktober-fest in Deutschland but that didn't work out
 

« first day (370 days earlier)      last day (4571 days later) »