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...
Type: Posts; User: ghoul
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...
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 {
/*...
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...
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...
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...
And, last but not least, this is not a democracy. More or less an aristocracy ;-). So, well, a poll might not achieve much
Well, on taking a second look, it looks like you are right.
Just a nitpick here. It looks like your code will definitely leak memory
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...
I was under the impression that you could use _VA_ARGS__ in this case
But
It seem it can only be used in macros.
'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?
I was mostly talking about Microsoft compilers.
But, well, anyways, you are right, nevermind.
Well,.....
Notice typeof is only available on some systems, probably GCC only?
Or..... :
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
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
Yeah, interesting. That caught my eye, too.
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;
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...
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...
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()
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...
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...
Hello,
This is probably petty, if not very petty but...
Can someone critique my string splitting API.
#include <stdio.h>
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...
Hello friends,
I am tasked with refactoring the following code so that is it is easily maintainable.
#include "libs.hpp"