Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-

http://samusev.pp.ru/texts/safe_c_programming.html

Name: Anonymous 2014-04-06 0:52

safe

Name: Anonymous 2014-04-06 3:01

The only safe C is abstinence.

Name: Anonymous 2014-04-06 7:35

>>1

Safe C programming[br]Yegor Samusev
Shalom!

Name: Anonymous 2014-04-06 8:18

Safe C programming exists and is called ATS:
http://www.ats-lang.org/

Name: Anonymous 2014-04-06 8:22

fun fibats
{n:nat} (n: int n)
: [r:int] (FIB (n, r) | int r) = let
fun loop {i:nat | i <= n} {r0,r1:int} (
pf0: FIB (i, r0), pf1: FIB (i+1, r1) | ni: int (n-i), r0: int r0, r1: int r1
) : [r:int] (FIB (n, r) | int r) =
if ni > 0 then
loop {i+1} (pf1, FIB2 (pf0, pf1) | ni - 1, r1, r0 + r1)
else (pf0 | r0)
// end of [loop]
in
loop {0} (FIB0 (), FIB1 () | n, 0, 1)
end // end of [fibats]

Name: Anonymous 2014-04-06 19:18

ATS looks like obfuscated brainfuck.

Name: Anonymous 2014-04-07 16:46

>>5

That is one ugly syntax!

Name: Anonymous 2014-04-10 21:40

>>2

Is there a morning after pill equivalent for C programming?

Name: Anonymous 2014-04-11 3:09

The only thing on that list that's absolutely unsafe to use is gets. If you're too stupid to know whether the size of your output can exceed the limits of its buffer you shouldn't be using the language. People who are too dumb to figure out whether it's safe to use the non-truncating form of these functions are frequently also too dumb to determine the correct length to pass to the truncating form.

The real problem that needs addressing is why you're using C strings in the first place.

Don't change these.
Name: Email:
Entire Thread Thread List