Search:

Type: Posts; User: ghoul

Page 1 of 4 1 2 3 4

Search: Search took 0.01 seconds.

  1. Replies
    3
    Views
    340

    Sorry about the typo. You are right. Thanks ...

    Sorry about the typo.

    You are right. Thanks



    I don't think it possible to debug the kernel with valgrind but there's kmemleak(which reports memory leaks). And, even if it was, it probably...
  2. Replies
    3
    Views
    340

    Possible Null dereference in code.

    I'm looking at some Linux code and something seems strange to me.

    In the code below, it is not clear to me what the else clause achieves and whether it is broken...




    } else {
    /*...
  3. Replies
    1
    Views
    1,021

    I'm not sure what exactly you are asking because...

    I'm not sure what exactly you are asking because your question is too general.

    But for a start, if you haven't done this already.... You probably need to declare a struct where you store your...
  4. Replies
    13
    Views
    2,370

    Speaking of which, may be I'm hijacking this...

    Speaking of which, may be I'm hijacking this thread at this point.

    My finer implementation works but chokes on NULL....



    int strCmp(const char *s1, const char *s2 )
    {
    const char...
  5. Replies
    13
    Views
    2,370

    No, that way you would be comparing pointers. A...

    No, that way you would be comparing pointers. A pointer is equal to the other point if they point to the same memory location.

    Ha! I quickly put together an implementation of strcmp that even I do...
  6. Poll: And, last but not least, this is not a democracy....

    And, last but not least, this is not a democracy. More or less an aristocracy ;-). So, well, a poll might not achieve much
  7. Well, on taking a second look, it looks like you...

    Well, on taking a second look, it looks like you are right.
  8. Just a nitpick here. It looks like your code will...

    Just a nitpick here. It looks like your code will definitely leak memory
  9. While this is possible, it might turn out more...

    While this is possible, it might turn out more complicated than other cases which are simple enough.

    My guess is that one would have to keep track of the size of the currently allocated memory...
  10. Replies
    5
    Views
    1,158

    I was under the impression that you could use...

    I was under the impression that you could use _VA_ARGS__ in this case

    But

    It seem it can only be used in macros.
  11. Replies
    9
    Views
    1,053

    'tail' is a unix command. I am not sure there is...

    'tail' is a unix command. I am not sure there is a a windows equivalent but if you can probably get it via cygwin. Maybe via some other ways too?
  12. Replies
    10
    Views
    695

    I was mostly talking about Microsoft compilers. ...

    I was mostly talking about Microsoft compilers.

    But, well, anyways, you are right, nevermind.
  13. Replies
    10
    Views
    695

    Well,..... Notice typeof is only available on...

    Well,.....

    Notice typeof is only available on some systems, probably GCC only?
  14. Replies
    10
    Views
    695

    Or..... : #include #include...

    Or..... :




    #include <stdlib.h>
    #include <stdio.h>
    #include <string.h>
  15. Replies
    6
    Views
    773

    Thanks for spotting that. I actually have more...

    Thanks for spotting that. I actually have more such in the code.




    Sorry, I did not compile this yes because my code does not compile yet o.O
  16. Yeah, interesting. That caught my eye, too.

    Yeah, interesting. That caught my eye, too.
  17. Replies
    6
    Views
    773

    I came up with this but are not sure it is right:...

    I came up with this but are not sure it is right:



    void traverse(struct n *head,
    void (*callback_func)(void *user_data, int *free_flag))
    {
    struct n *p, prev = NULL;
  18. Replies
    6
    Views
    773

    Freeing a random node from a linked list

    I'm struggling with freeing a random node in a singly linked list.

    With my current code below, if a random node happens to be freed, it will discontinue the list splitting it into two part and...
  19. Replies
    5
    Views
    408

    Okay, got it now. What this code does is...

    Okay, got it now.

    What this code does is essentially to loop through an array of strings or a list of strings. This list/array does have a sentinel value at the end, though. It is possible to...
  20. Replies
    5
    Views
    408

    Didn't quite get the part about the compiler but...

    Didn't quite get the part about the compiler but I suppose the code should be equivalent to this:




    #include <stdio.h>
    #include <string.h>


    int main()
  21. Replies
    5
    Views
    408

    String testing equality

    I have a code like the below, based on another similar code from the internet. Now, this code uses the not equal operator to compare between string while, to my knowledge, 'strcmp' should be what to...
  22. Replies
    4
    Views
    447

    Noticed this after making the post here: ...

    Noticed this after making the post here:



    char **result = malloc(sizeof(char));


    And was even more surprised that code was working... What exactly was happening?

    So, I have this, let...
  23. Replies
    4
    Views
    447

    Critique my string splitting API

    Hello,

    This is probably petty, if not very petty but...

    Can someone critique my string splitting API.




    #include <stdio.h>
  24. Thread: Code refactor

    by ghoul
    Replies
    5
    Views
    638

    I agree with the use 'const' here but why did you...

    I agree with the use 'const' here but why did you use the storage specifier 'static' in this context? Is it really necessary? I don't understand...
  25. Thread: Code refactor

    by ghoul
    Replies
    5
    Views
    638

    Code refactor

    Hello friends,

    I am tasked with refactoring the following code so that is it is easily maintainable.



    #include "libs.hpp"
Results 1 to 25 of 76
Page 1 of 4 1 2 3 4