| |
| |
| |
|
Page: 1 2 3 4 5 6 7 8 9
Comments:
<0> what's wrong with line 23 ? <1> DrkMatter: I tried the memcpy(temparray+1, array1, size); WHen I tried to display the array it is coming up with invalid values. <2> corstan: Where's the code? <0> DrkMatter, did you look at the link? <2> All there is at this link are error codes. <0> sorry <0> http://rafb.net/paste/results/UtIhLR32.html <0> I get this: error: invalid types `const double[int]' for array subscript <2> const double& array <2> YouR'e p***ing ina reference to a const double. <2> It's not ana rray. <2> Hence, you can't sue the subscript operator on it. <2> Noid858: LEt em look at your code again, I guess. <0> what should I p*** then? <0> just the array <3> the array and the number of elements in it
<3> as a pointer <2> You should p*** an array, or a pointer. <0> ok, that works <3> I don't understand why you need these functions <2> Noid585: The "sieze" you are p***ing is a plain int <0> why can't I p*** a reference, isn't that what is normally done? <2> You should p*** size * sizeof(int). <1> just did that =) didn't work still <0> Debugger, because I use older C code which uses double arrays instead of STL cl*** objects <1> Can you try compiling my code and see if it does the same for you as it does for me.. You'll understand better what's happening.. I create the array with 2 elements for "size", I display the array to make sure it worked. I go to insert to the front of the array type a value and then it displays the temparray with incorrect values. <2> I don'T really ahve tiem for that, Noid858 <3> Is memory in a valarray contiguous like std::vector? <2> Do you ahve a debugger, Noi858? <3> If that's the case, it'd be easy <1> Yes I'm using visual studio <0> Debugger, you mean successive elements? <3> yes, if that's the case, just cast the vector <2> Try debugging your app. Check what's in the memory location before and after the memcpy. <0> Debugger, didn't think of that, but I am just being safe and doing this through specialized inline functions <2> Noid858: Make sure that array1 as the correct values before the copy. <1> It does. THe problem exists with the memcpy command for sure. <1> I got it to work <1> Thanks for the help DrkMatter <2> No problems. What was the problem? <4> yo what's the best book for leanring visual C++ 2005 if you dont have much or any progrimmag exp <3> Accelerated c++ <1> Drk: The problem was that I had memcpy backwards. Its destination, source and size <2> Ah... <4> guys is the C++ from visual studio 2005 the same as 2003, 2002, and 6.0? <2> More or less. <2> It is C++, but the later compilers are mroe standardd compliant. <5> less bugs <2> So, technically, VS 2005 is MORE C++ish than VS 6.0 <1> Hmm so weird. I don't have to delete [] array1 if I want to insert a new value into the array?? I thought arrays are not dynamically resizeable <4> ok well i need something to teach me c++ w/ visual studio 2005 professional and i've just started programming <4> is a 2003 guide or a fairly old book as vlaid? <4> valid? <4> like, msv c++ 2003 good for 2005 ms <6> http://www.cprogramming.com/tutorial/lesson1.html <4> er 2003 guide for 2005? <5> lol <5> Zelotes, C++ is the same <5> if you want to know how to use the IDE just press F1 <4> so anyone here who has been programming for MANY years? <6> indeed <5> I'm afraid to check my todo list... I have a really nice feeling that I've finished everything for this week and I don't want to ruin it <5> of course... <2> Noid858: Arrays are -not- dynamically resizable. <2> Well, wait. <2> It's been too long since I've done this kind of thigns. <1> Drk: I thought so too but I got rid of my delete [] array1, int* array1 = new int[newsize] and it worked. It is adding new elements to array1 without needing to be redeclared as a larger size. <5> lol <2> C++ odens't do bound checks for you <4> so anyone here who's been doing C++ for yeatrs <2> *doesn't <2> If you write over memory you do not own, you might cause a system crash. <5> delete [] <2> So what you're doing compiels, and MAY run fine, but it is incorrect. <5> use delete [] when you use new type[xx] <1> array1 is a pointer to an array so I tried delete [] array1 and it crashes :( <5> and it doesn't matter that the compiler "might" see what you're tring to do and fix it for you
<5> if you compile the same code on a diffrent compiler it might not work <5> *trying <2> Noid858: delete [] for new []. If it crashes, then you did somethign wrong with the pointers. <2> Possibly, you ***igned array1 a new value without noticing. <1> Drk: but I don't have to specify which [] I"m deleting? How does it know if I'm deleting array1 or temparray? <2> Huh? <2> delete [] array1 <-- Delete array1. delete[] temparray -- delete temparray. <1> Let me describe what is going on. So I basically have 2 pointers to integer arrays. array1 and temparray. I ***ign array1 some values, then I select a function to insert a value into the front of temparray. I then try to delete [] array1 and the program crashes with a heap exception. <2> Well, the way you put it... <2> 1. You cannot"insert" a value if the array is full wihtout going overbound. <2> 2. There shouldn't be any crash when calling delete. You must be doing something wrong in between. <1> Sorry I forgot to include the fact that I define temparray to be a size one larger than array1 and I memcpy the contents of array1 into temparray. <2> Well, you should post your updated code, it'd give us(me) a better idea. <1> http://www.noidea128.org/sourcefiles/15909.html <1> Ignore the actual function called int *&insert_f_array(int *&thearray, int s, int v) at the bottom <1> All my inserting is happening in case(2) <4> so uh <4> basically im trying to create an overhead rpg kind of like final fantasy 6 or similar snes rpgs <4> i can use tiles and sprites from those kinda games, but what i think i really need is basic programming knowledge <4> what language is best for an snes rpg: c++ or basic? <7> Are you actually writing for the SNES? <4> no <8> wasn't most snes development done in snes ***embly? <4> it's PC <8> (i might be wrong) <8> then why did you say "snes rpg" ? <7> There are some RPG creation tools <8> "snes" isn't "pc" <7> Drop in your tiles and sprites and rules and such <4> i said LIKE an snes rpg <7> rdragon, he meant rpg in the style of some of the snes rpg's <8> no, you said "for" <7> Don't make me otter you <4> ya <7> ! <4> no i can't do that, because the rpg is more of a personal rpg, it's part snes style rpg but also there's a database attached to it and other things <8> lol <7> That was uncool :( <9> whatever, we all had a good laugh. <8> Zelotes - you just want to make a tile based game? <7> Heh <4> well i believe snes is tile based so yeah <8> well, i would suggest C++ over basic for anything besides modifying Gorillas <4> tiles, with sprites (and my sprite changes) <4> i want characters to move back in forth like in ff <8> www.gamedev.net has a bunch of resources, and forums, etc <4> im thinking a tile-based game has something to do with using a grid similar to excel, with each tile taking up a certain amount of space <8> sure <4> then programming each grid to work a certain way and allow the character to work a certain way? is that close? <4> and have it all work in suhc a way that it looks similar to an snes rpg <8> well, are you thinking top-down or side-scroller? <4> top-view yeah <4> the kinda game where you see their heads for the most part with a little bit of the body <8> if top-down, you'll likely have some kind of grid-based map, and informatino for each tile: the image, whether it can be walked on, whether it triggers some event, what object is occupying it, etc <1> Can anyone take a look at http://www.noidea128.org/sourcefiles/15910.html and let me know why my delete [] array1; in case (2): is causing a heap corruption error in Visual Studio 2005 Pro? <8> Noidea why aren't you just using a vector? <4> yeah <4> snes rpg seems a lot easie to make then those 3d ff7 type things <1> rdragon: Teacher is requiring to do it by scratch. No STL <9> What? <9> I am using vectors! <9> I swear! <9> I use them all the time! <8> er, lol <9> Just today I changed 2 lists to vectors! <8> Noid858 well this is silly.. you should just mimic the operations of a vector... none of this new[1] and memcpy nonsense <4> ok <4> so i should go w/ c++ instead of visual basic for making a rpg game of snes quality? <8> surely <9> the world really needs another Ultima 7 <9> that was the pinnacle of video game development right there <5> I would do it like that, in a separate header <9> it's been downhill ever since.
Return to
#c++ or Go to some related
logs:
no undernet merida #chatzone avl operator+ script of amlet #linux #networking javascript optional prameter gedit column select #linux c4013 fileno
|
|