Search:

Type: Posts; User: oomakoo

Search: Search took 0.00 seconds.

  1. Replies
    34
    Views
    4,426

    Sorry that you've given up because I still don't...

    Sorry that you've given up because I still don't understand. I did some tests that I posted earlier in the thread that show that there is no difference between casting and not casting when there are...
  2. Replies
    34
    Views
    4,426

    Whoops! This is why I like to use sizeof() for...

    Whoops! This is why I like to use sizeof() for all my malloc()s. :-)

    My point was that by casting the compiler checks the type of the memory that I *think* I'm allocating. Without the cast the...
  3. Replies
    34
    Views
    4,426

    I ran your code: #include int...

    I ran your code:

    #include <stdlib.h>
    int main()
    {
    char *p;
    p=(char *)malloc(30);
    if(p==NULL)
    {
    printf("Oops, not enought mem.");
  4. Replies
    34
    Views
    4,426

    I don't think I do. malloc() will always return...

    I don't think I do. malloc() will always return a void *. If you tell the compiler what you think it should be cast to (by explicitely casting) then the compiler can tell you whether you are right...
  5. Replies
    34
    Views
    4,426

    IMHO, while not strictly necessary, casting the...

    IMHO, while not strictly necessary, casting the return from malloc() is good programming practice and should always be done - there is no reason not to do it. And getting into the habit of using...
  6. Replies
    34
    Views
    4,426

    malloc(), etc. allocate on to the heap not the...

    malloc(), etc. allocate on to the heap not the stack.

    there is a function alloca() that allocates on to the stack but that's not what you want is it?
  7. Replies
    2
    Views
    1,077

    I am using C and the variable in the .so is a...

    I am using C and the variable in the .so is a static int.

    My program calls one of the functions in the .so and initialises it to a unique value. Then control returns back to the program. Then,...
  8. Replies
    2
    Views
    1,077

    .so and top level static

    I have a program that is invoked many times simultaneously. The program uses a dynamic library. In the library there is a top level static integer that I want to have a unique value for each...
Results 1 to 8 of 8