User Profile

Collapse

Profile Sidebar

Collapse
crispin
crispin
Last Activity: Feb 28 '07, 04:50 PM
Joined: Jan 31 '07
Location:
  •  
  • Time
  • Show
  • Source
Clear All
new posts

  • crispin
    replied to Strange Behaviour initializing bool
    in C
    Perfect - This explains a lot. Thanks for your advice :)
    See more | Go to post

    Leave a comment:


  • crispin
    started a topic Strange Behaviour initializing bool
    in C

    Strange Behaviour initializing bool

    Hi,

    I was under the impression that bool's were false by default... Am I wrong about this?

    In VC++6, when I define a bool in a class header (i.e. bool testbool) and then access it BEFORE I have initialized it to a definite value, it returns 1. I am sure that I have not accidentally initialized it to true anywhere. Just curious, is it supposed to be this way?

    Cheers,
    Crispin
    See more | Go to post

  • crispin
    replied to 3D arrays
    in C
    The whole array so that it can be reallocated --

    Ganymede -- re. the PM. Sorry, I didn't mean to ignore your post - I was just hoping that there was a way to delete the whole array without cycling through every single element.

    Cheers,
    Crispin
    See more | Go to post

    Leave a comment:


  • crispin
    replied to 3D arrays
    in C
    Hi,

    Thanks to both of you for your replies --

    So is it necessary to create a loop and delete every element individually when the array is larger than 2D? I was king of hoping that I could just use
    delete[][] blabla[firstDimension] for a 3D array, but I don't wan't any memory leaks.

    Cheers,
    Crispin
    See more | Go to post

    Leave a comment:


  • crispin
    started a topic 3D arrays
    in C

    3D arrays

    Hi,

    I have been working on allocating and deleting multi-dimensional arrays...
    I gather that to delete a 2D array correctly, you need to do the following:

    for (int a = thisFirstElemen t; a < totalFirstEleme nts; a++)
    {
    delete[] blabla[a];
    }

    But how would I delete a 3D array? Would it just be delete[][] blabla[a] or am I missing something?

    Thanks,
    C...
    See more | Go to post

  • crispin
    replied to Pointer Array Question
    in C
    Thanks a lot Ganon, that really clears things up.

    Does the same thing apply for char strings... i.e. if you initiate a char array (unsigned char *b). Do you deallocate the string like an array (delete []b) or like a single pointer (delete b).

    Cheers,
    Crispin
    See more | Go to post

    Leave a comment:


  • crispin
    started a topic Pointer Array Question
    in C

    Pointer Array Question

    Hi,

    I was wondering if I can do the following without creating memory problems:

    Create something like -- int * array1 -- as a public member my class

    then initiate it with a new value every time I run a certain function, like this --- array1 = new int[somenumber] ---

    but ONLY delete it in the destructor --- delete [] array1 ---

    If I reinitiate it with a new value...
    See more | Go to post

  • crispin
    replied to include techniques
    in C
    Hi Ganon,

    This is what I was looking for, thank you ;)

    Sorry about the double post, but I hit back and then thought I had forgotten to post it at all.

    Cheers,
    Crispin
    See more | Go to post

    Leave a comment:


  • crispin
    started a topic include techniques
    in C

    include techniques

    Hi,

    Proper file including is a part of C++ that I obviously didn't understand very well, because I've been puzzling over this for a couple of hours.

    Lets say there are 4 files:

    file1.cpp
    file1.h
    file2.cpp
    file2.h

    file1.cpp needs access to file1.h and file2.h ... file2.cpp needs access to file1.cpp and file2.h AARRG I can't work out the proper way to include this...
    See more | Go to post

  • crispin
    replied to Passing a Class as a Pointer
    in C
    Hi,

    Thanks for your help... I got it working!

    I passed the class as 'this'. And added 'MiniHost *m = (MiniHost*)user Data;' in the static int. To use the methods I simply type m->whatever();

    Cheers,
    Crispin
    See more | Go to post

    Leave a comment:


  • crispin
    started a topic Passing a Class as a Pointer
    in C

    Passing a Class as a Pointer

    Hi Everyone,

    I was hoping one of you kind souls could help me with the following:

    I have a class method which initializes audio libraries written in C, shown below... where it says (RIGHT HERE) I am trying to create a pointer to the class MiniHost, am I doing it right?

    >>>>>

    void MiniHost::setup Audio()
    {
    ////Some unimportant stuff here, then:...
    See more | Go to post
No activity results to display
Show More
Working...