Professional Documents
Culture Documents
Embedded Systems
Astrit ADEMAJ
Prishtinë
Agenda
Programeri gabon
◼ Stili dhe mundesit e shprehjeve ne gjuhen C
◼ Sa eshte “robuste” gjuha perkunder gabimeve?
◼ Sa eshte gjasa qe prej nje konstrukti te
gabueshem te gjenerojme nje kontrukt valid?
◼ Cilat gabime i detekton gjuha?
if (x == y)
if (x = y) foo();
foo();
if ((x = y) != 0)
foo();
= nuk eshte ==
==
While (c
= ' ' || c == 't' || c == '\n')
c = getc(f);
Interpretimi leksikal (2)
if (x == 0)
if (y == 0) err();
else
f(x,y);
if (x == 0)
{
if (x == 0) if (y == 0) err();
if (y == 0) err(); }
else else
{ {
f(x,y); f(x,y);
} }
Literature
Andrew Koenig, C Traps and Pitfalls, Addison
Wesley, 1988
Les Hatton, Safer C, McGraw-Hill, 1994
Regullat per aplikacionet kritike
MISRA, Guidelines for the Use of the C Language in
Vehicle Based Software, 1998
Hecht, et al., Review Guidelines for Software
Languages for Use in Nuclear Power Plant Systems,
US Nucl. Reg. Comm., 1997 (WWW)