Writing safer C programs

  • Thread starter Pradyot Dhulipala
  • Start date
P

Pradyot Dhulipala

Can some one please point me to a comprehensive resource for writing C
programs?I checked out Steve Summit's FAQ.
Thanks,
Pradyot
 
J

Jack Klein

Can some one please point me to a comprehensive resource for writing C
programs?I checked out Steve Summit's FAQ.
Thanks,
Pradyot

Somehow the adjective "safer" did not make it from your subject line
into the body of the message. But assuming you still meant "safer":

Safer C: Developing Software for High-integrity and Safety-critical
Systems Engineering)
Les Hatton
Paperback 229 pages (1 December, 1994)
Publisher: McGraw-Hill Education - Europe; ISBN: 0077076400

C Traps and Pitfalls
Andrew Koenig
Paperback 160 pages (January 1989)
Publisher: Addison Wesley; ISBN: 0201179288

Expert C Programming: Deep C Secrets
Peter Van Der Linden
Paperback 350 pages (30 April, 1994)
Publisher: Prentice Hall; ISBN: 0131774298

Also:

Guidelines for the Use of the C Language in Vehicle Based Software
The Motor Industry Software Reliability Association (MISRA)
Available only directly from http://www.misra.co.uk.

--
Jack Klein
Home: http://JK-Technology.Com
FAQs for
comp.lang.c http://www.eskimo.com/~scs/C-faq/top.html
comp.lang.c++ http://www.parashift.com/c++-faq-lite/
alt.comp.lang.learn.c-c++ ftp://snurse-l.org/pub/acllc-c++/faq
 
C

Charles Harrison Caudill

Pradyot Dhulipala said:
Can some one please point me to a comprehensive resource for writing C
programs?I checked out Steve Summit's FAQ.
Thanks,
Pradyot

something else to try is linking a garbage collector into your program.
Do some googling, i'm not sure what it's called, but someone wrote a good
reliable, gc. that entirely eliminates core dumps caused by frees and also
eliminates some memory leaks.
 
P

Paul Shipley

Jack Klein said:
Somehow the adjective "safer" did not make it from your subject line
into the body of the message. But assuming you still meant "safer":

Safer C: Developing Software for High-integrity and Safety-critical
Systems Engineering)
Les Hatton
Paperback 229 pages (1 December, 1994)
Publisher: McGraw-Hill Education - Europe; ISBN: 0077076400

C Traps and Pitfalls
Andrew Koenig
Paperback 160 pages (January 1989)
Publisher: Addison Wesley; ISBN: 0201179288

Expert C Programming: Deep C Secrets
Peter Van Der Linden
Paperback 350 pages (30 April, 1994)
Publisher: Prentice Hall; ISBN: 0131774298

Also:

Guidelines for the Use of the C Language in Vehicle Based Software
The Motor Industry Software Reliability Association (MISRA)
Available only directly from http://www.misra.co.uk.

--
Jack Klein
Home: http://JK-Technology.Com
FAQs for
comp.lang.c http://www.eskimo.com/~scs/C-faq/top.html
comp.lang.c++ http://www.parashift.com/c++-faq-lite/
alt.comp.lang.learn.c-c++ ftp://snurse-l.org/pub/acllc-c++/faq

I've seen Cyclone mentioned in various places. "Cyclone is a programming
language based on C that is *safe*...", says the website. Although it is
designed to be compatible with C, it isn't exactly the same. Might not be
totally relevant, but could otherwise be of some interest.

http://www.research.att.com/projects/cyclone/

Paul.
 
D

Darrell Grainger

Somehow the adjective "safer" did not make it from your subject line
into the body of the message. But assuming you still meant "safer":

Safer C: Developing Software for High-integrity and Safety-critical
Systems Engineering)
Les Hatton
Paperback 229 pages (1 December, 1994)
Publisher: McGraw-Hill Education - Europe; ISBN: 0077076400

C Traps and Pitfalls
Andrew Koenig
Paperback 160 pages (January 1989)
Publisher: Addison Wesley; ISBN: 0201179288

Expert C Programming: Deep C Secrets
Peter Van Der Linden
Paperback 350 pages (30 April, 1994)
Publisher: Prentice Hall; ISBN: 0131774298

Also:

Guidelines for the Use of the C Language in Vehicle Based Software
The Motor Industry Software Reliability Association (MISRA)
Available only directly from http://www.misra.co.uk.

One small correction: http://www.misra.org.uk
 
P

Pradyot Dhulipala

Thanks a lot.I was hoping for online resources.I am not able to get
the books by the time I need them.
Safer C programing tips along the lines of don't use gets, strcpy etc.

Thanks,
Pradyot
 
D

Dan Pop

In said:
Safer C programing tips along the lines of don't use gets, strcpy etc.

Whoever told you to avoid strcpy is a patent idiot. Unlike gets, it is
perfectly possible to use strcpy in a fully portable and safe manner.

If you don't know what you're doing, you can't use pointers, arrays,
signed arithmetic and floating point arithmetic. Try writing some
useful real world applications with what's left.

If you know what you're doing, you don't need any safer C programming
tips, so my advice is to simply learn C (up to the point where K&R2 and
its exercises have no more secrets for you).

Dan
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,057
Latest member
KetoBeezACVGummies

Latest Threads

Top