| |
| |
| |
|
Page: 1 2 3 4 5 6 7 8 9 10 11 12
Comments:
<0> k <1> The other day I saw some graffiti talking about something like that. <1> I won't say what it read because it's a bit too offensive if there's any navy or marine corps people here. <0> just day it man, well i'm not from tha us but i don't think anyone would disagree <0> it's just a statement from somebody anuyway don't worry about it <1> This is an army/air force base for the most part. There are few sailors and marines. <1> here <2> hey, semi-new guy to c++... could anyone explain the use of pointers? they just seem troublesome to me <3> abooga <3> Static memory has to be allocated at compile time <3> If you're tracking players in an online game <3> And one more player joins <3> If you only allocated 20 player slots at compile time, you can't account for him now. <1> abooga303: Try google. There are plenty of sites that explain this type of things. Not to mention books. <3> Or, a more practical example <3> If you want the user to input a string
<3> You don't know how long it will be <3> So if they need to store an entire file's contents in that string <3> You'd better have made it a huge string at compile time, thus being very wasteful and inefficient <2> ah, thanks for the answer JBlitzen <3> The better approach is to dynamically allocate the amount of memory you need, when you need it, if it can't be foreseen. <3> And the only way to dynamically allocate memory is to use "new" or "free". <3> Both of which return pointers <3> So, there you go. <1> free? <2> thank you =) <3> er <3> malloc <2> but unfortunately =/ this means I have to learn pointers <3> :D <3> Pointers are real easy. <3> Don't let people tell you they're complex. <4> it's pretty basic stuff <3> Think of them like a chess piece. <3> It's real easy to figure out how it behaves <1> True. Some texts scare people away from pointers and so people read too much into them when it's a simple concept. <3> And, 40 years later, you might have some inkling as to how to use it well <3> Yeah <3> Don't overthink pointers. They are exactly what they call themselves. <0> it's just a statement from somebody anuyway don't worry about it <4> google object oriented programming <4> it's very useful <3> That actually wouldn't be useful at all in understanding pointers <0> wrong window sorry <2> I know the basics, I can understan the oob concept. <3> er <2> it's just pointers are a bit scary =/ <2> I dunno why <2> *shrugs <1> Whatever happend to the large trout? <3> Figure out why linked lists work the way they work <3> Then figure out how they work <3> And you'll understand 90% of what you need to know about pointers <2> ok <4> JBlitzen that was hjow i learned about it anyways <4> practical use of them <4> pointers that is <0> i meant to say: Jbilzen: nicely said <3> The other 10% is dealing with dynamically allocated arrays <0> sorry Blitzen <3> But really, that's just a matter of using []'s here and there, the same principles apply. <2> just as my two cents, I was running thru the tutorials on cplusplus.com <2> taking about 2 per day <2> I slowed down since then <2> seeing pointers, that is <3> Don't be too intimidated by pointers <3> They're exactly what they call themselves. <2> heh I go tthat much =) <3> They're just a special data type that stores a memory address. <3> Just like a postal address. <3> Really, the best example is exactly what they are. <3> int x = 5; <3> That's an integer data type stored in a static memory slot big enough to hold an int, currently occupied by the data 5 <3> int *p = &x; <3> That's a pointer data type stored in a static memory slot big enough to hold a pointer, currently occupied by the memory address of x
<3> cout << *p; <3> Spits out the dereferenced (what-its-contents-point-at rather than its-contents) value of p <3> In this case, 5 <3> Easy <2> yes yes <2> I could understand that <2> I just didn't really see the practical use.. <3> It's all over the place <2> and kinda had the thought in my mind that they weren't needed, but I learned otherwise from you =) <5> yeah, now try to use em without leaving any edge cases that do bad things and you are ahead of the game ;) <3> Every time you add an auction to ebay, you think they statically allocated memory for it four years ago? <3> Now, in a sense, they don't dynamically allocate it either. <3> But databases work much like dynamic memory works. <3> You store data in a file, with some sort of address to find it, and you use the address all over <3> That way, the order of the actual data doesn't matter <5> except uber more safe for concurrent operations <3> File systems are made the same way <3> Yeah <3> But the fundamentals are all there <3> In fact, your file system is probably a great analogy of your program's memory space. <3> You have some files which are just documents, whatever <3> And you have other files which might reference those documents <3> Shortcuts <3> A pointer is just a shortcut <4> very good example <5> speaking of file systems... is it just me, or doesn't it **** that NTFS and other win file systems have no way to lock files for exclusive access <6> pointing is what people do to JBlitzen <6> shortly followed by "what a freak!" <3> Pointing is how khan dances <3> http://images-eu.amazon.com/images/P/B00006FN01.03.LZZZZZZZ.jpg <2> hahahah <6> you look horrible in white <2> oh man <3> I know, khan, but really, your red dress just makes my suit look bad <3> It's the comparison that does it <6> perhaps you should have bought me something nicer <2> hmm, I can see how pointers would make it easy in the file system sence, as in user interaction with the program <1> My parents were having the same argument the day they got married. <3> You didn't deserve nicer <2> I just still don't see the use in it in the program itself... I don't think I understand the static vs dynamic stuff yet. <2> I'll probably learn it later though <2> thanks alot =D <3> abooga, file systems work on the basis of file pointers, actually. <3> When you add a file to your system, then open windows explorer, it doesn't search every bit on your hard drive to generate a list of files <3> It stores an index of file pointers that it can easily manipulate <6> once you understand about how the actual hardware works, pointer support in a potential system level programming language makes sense <3> And what that enables you to do is add and delete and move files very easily <3> Dynamically, as many or as few as you want <3> Whenever you want <2> i see <3> You aren't limited to some statically allocated array of 64 files <3> And you can never create more than that <3> Obviously that wouldn't make any sense whatsoever, it'd be like thinking of khan as straight. <6> when in fact i'm a god <3> And doing it dynamically without pointers would require windows explorer constantly searching your hard drive to see what the file structure looks like <3> Which would be equally stupid <0> peterhu: :) don't forget you are my demi god <0> lol <3> demi gaey <1> demi actually means gay in spanish <0> woohoo <6> that would be JBlitzen stupid, actually <7> clsk: Still here? <0> clsk: seems you have a bit of a projetion problem, anyway i thought this channel was about c++ <3> Gowyl, peterhu is khan, and he's gay <3> So we're just having fun at his expense <0> ow k, didn't knox <0> w <8> hmmmm <8> i have a math/c++ problem which i can't wrap my sad little head around <8> I'm working on a genetic algorithm thingie... and I want to use roulette selection... but I can't figure out how i would go about ordering the list of fitness val... hell i don't even think i'm thinking about it right
Return to
#c++ or Go to some related
logs:
#linux dame una mamada in english #networking hp pavilion ze2000 linux trigger.pl irssi What is the only place in Europe where ape's live free ?
#php foxx il-madonna #linux #AllNiteCafe
|
|