Reputation
1,227
Top tag
Next privilege 2,000 Rep.
Edit questions and answers
Badges
6 24 53
Impact
~212k people reached

12h
comment How to write C for POSIX?
I updated the question with more information. I think best is a test that says "This program is 80 % POSIX compliant" or likewise.
12h
revised How to write C for POSIX?
added 249 characters in body
12h
asked How to write C for POSIX?
12h
comment Java Certification exam materials and objectives
You can find it on amazon. (OCA: Oracle Certified Associate Java SE 8 Programmer I Study Guide: Exam 1Z0-808 [Jeanne Boyarsky, Scott Selikoff] on Amazon.com. )
1d
accepted When to malloc and free?
1d
comment When to malloc and free?
@StephenC Actually I found the leak again. Valgrind reports a memory leak and now I see that I don't do free after I do string[j] = strdup(argv[j]); because I didn't know that I have to do it. I learnt it here yesterday that strdup requires that I free() . Let's try again after I set it free.
1d
comment When to malloc and free?
The readline code you posted actually helped because when I use it, there is no memory leak reported by Valgrind and that was my goal.
2d
revised Unit testing C code?
deleted 99 characters in body
2d
revised algorithm for shell language interpreter to find if a char is between quotes
fixed the code (it didn't compile) so that it works
2d
comment When to malloc and free?
I posted the offending code. There is a memory leak BUT only during the test. I'm using Valgrind with more and more options to understand what is wrong. I'm freeing from malloc in the loop but maybe I misunderstood. I don't have much experience with this detailed level of C and RAM, but I'm sure we will find the memory leak because there is so much information and reproducable.
2d
revised When to malloc and free?
added 915 characters in body
2d
revised When to malloc and free?
added 1205 characters in body
2d
revised When to malloc and free?
added 1722 characters in body
2d
revised When to malloc and free?
added 120 characters in body
2d
comment When to malloc and free?
@StevieV Valgrind is cool! It will give you the line number of the offending code. I get a memory leak if I use readline but not if I use editline. But it is only Valgrind that is reporting the memory leak and during my automated integration test I scripted. Valgrind does not report a memory leak during actual usage, only during the test.
2d
comment When to malloc and free?
@StevieV I'm reading input that should be large. I'm reading input that is a shell program that could be very large. No matter how I do valgrind reports a memory leak but only during my tests, never during actual usage does valgrind report a memory leak, and the program doesn't crash. The line it is complaining about is readline. From readline.h
2d
revised Unit testing C code?
added 1876 characters in body
2d
asked Unit testing C code?
2d
revised When to malloc and free?
added 170 characters in body; edited tags; edited title
2d
revised When to malloc and free?
edited body