Search:

Type: Posts; User: TalonStriker

Page 1 of 2 1 2

Search: Search took 0.00 seconds.

  1. LOL. I blame the compiler anyway for giving me...

    LOL. I blame the compiler anyway for giving me the wrong error message ;)
  2. This is the stupiest compiler error I've ever seen

    list.c:35: error: void value not ignored as it ought to be


    This is the code:


    Table *create(void)
    {
    return NULL;
    }
  3. edit: I found the bug!!!!!!! Turns out that it...

    edit: I found the bug!!!!!!!

    Turns out that it had nothing to do with overwriting memory at all.

    In this code in delete()



    /* update the capacity of the table */
    if...
  4. but this is precisely the sort of thing that...

    but this is precisely the sort of thing that mcheck is supposed to prevent right? If you do overrun, mcheck will start complaining. Or does mcheck only complain when you overwrite the...
  5. As far as I'm concerned I really don't care if...

    As far as I'm concerned I really don't care if valgrind catches it or not...what matters is whether the mcheck functions catch it since thats the only way the professor can check my code for memory...
  6. I understand what you're saying (I'll implement...

    I understand what you're saying (I'll implement it in a sec) but I don't understand how this corrupts the heap. If I am indeed overwriting something because I'm going 16 bytes past where I want to,...
  7. GET_RELATIVE_MEM_ADDR_OF_INDEX is something I...

    GET_RELATIVE_MEM_ADDR_OF_INDEX is something I defined.

    #define GET_RELATIVE_MEM_ADDR_OF_INDEX(y) ((y)*sizeof(Item))
    yeah the macro name is itself bigger than the code it represents but i didn't...
  8. yes i changed that but it still doesnt work.well...

    yes i changed that but it still doesnt work.well this is actually a project for my class. The professor provided us with the tests (which we shouldn't modify) that use the mcheck funcs. So i have...
  9. the valgrind info: Reserving 301445280 to...

    the valgrind info:


    Reserving 301445280 to 301445728
    Alloced table at 301445216
    Adding 1, 100 to 301445280
    new items at 0
    Size: 0
    ==733== Invalid write of size 8
    ==733== at 0x4009E6:...
  10. Well yeah I've fired my debugger and looked at...

    Well yeah I've fired my debugger and looked at what heap->items is pointing to...so far I haven't caught anything fishy

    If you have the patience to look over the code, here it is (at least the...
  11. I don't think max has anything to do with it...

    I don't think max has anything to do with it because I'm not using it to base my calculations of the heap size.

    What entails heap corruption? I know that if you write past the end of allocated...
  12. Whaddya mean I clobbered past the mem block?

    For some reason valgrind is giving me a out of memory error... [:?]

    Firstly, here's the output of my program:

    Heres the code at causes the mem leak:


    printf("table at %d\n",...
  13. actually, nevermind. I foud the bug... The...

    actually, nevermind. I foud the bug... The valgrind error info was pointing at the spot where I allocated memory--ot where the leak occured.
  14. Well it's called from the first line of...

    Well it's called from the first line of get_trailer(char *), and I'm passing the results of this code into get_trailer()



    sscanf(command_string, "%s %s", command, arg1); //command_string is...
  15. I'm using this implementation of strdup. When I...

    I'm using this implementation of strdup. When I was checking whether I had any memory leaks, the compiler claims that there is a memory leak at line 4 of the function.

    1179 char *dup =...
  16. Replies
    22
    Views
    3,065

    I think I'll continue using the size of version,...

    I think I'll continue using the size of version, it makes more sense to me that way... I just wanted to make sure that the first version wasn't wrong



    oh yeah...thanks for pointing that out.
  17. Replies
    22
    Views
    3,065

    I'm confused, I changed 1077 to *(temp +...

    I'm confused, I changed 1077 to

    *(temp + (b-a+1) * sizeof(char)) = '\0'; /* add a NUL at the end */ and its still being skipped
  18. Replies
    22
    Views
    3,065

    Why is this statement being skipped?

    Look at this piece of code:


    1071 {
    1072 b = strchr(a, '\0');
    1073 finished = 1;
    1074 }
    1075
    1076 ...
  19. I see that strdup isn't on the list :( Heh, I...

    I see that strdup isn't on the list :(

    Heh, I learned more out of this ordeal that I bargained for.
  20. Actually, I didn't quite understand what...

    Actually, I didn't quite understand what "standard" meant in this context. From your explanation, for a function to be standard, its prototype should exist in the same library in all compilers....or...
  21. Ah... I see... suppose I hadn't used -Werror, it...

    Ah... I see... suppose I hadn't used -Werror, it would have created the object code...but would that object code be "wrong" (i.e. not run properly after linking)?
  22. Well I'm using the gcc compiler. Thanks. ...

    Well I'm using the gcc compiler.


    Thanks. I'm not sure why strdup() not being in standard C effects anything. According to the gcc API, strdup is supported in gcc. However, I'm compiling with...
  23. Compiler error: warning: implicit declaration of function 'strdup'

    Hi guys,

    When I compile this code, I'm getting the following error:
    warning: implicit declaration of function 'strdup'

    I've included <string.h> and <wchar.h> so I shouldn't be getting the...
Results 1 to 23 of 26
Page 1 of 2 1 2