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

I like C but not its syntax

Name: Anonymous 2014-12-02 12:11

Why hasn't anyone made C that doesn't look like dogshit?

Name: Anonymous 2014-12-03 19:02

Okay, OP, here you go. Here's what C might look like with a different syntax and basically no other changes (except fallthrough because fuck that)

function main(argc: Int, argv: [[Char]]) -> Int do
var ch: Int
var stdout_lock: FileLock
setlocale(LC_TYPE, "")
while (ch = getopt(argc, argv, "belnstuv")) != 1 do
case ch of
'b' =>
bflag = nflag = 1
'e' =>
eflag = vflag = 1
'l' =>
lflag = 1
'n' =>
nflag = 1
else
usage()
end case
end while
argv += optind
if lflag then
stdout_lock.l_len = 0
stdout_lock.l_start = 0
stdout_lock.l_type = F_WRLCK
stdout_lock.l_whence = SEEK_SET
if fcntl(STDOUT_FILENO, F_SETLKW, addr_of stdout_lock) == -1 then
err(EXIT_FAILURE, "stdout")
end if
end if

if bflag oror eflag oror nflag oror sflag oror tflag oror vflag then
scanfiles(argv, 1)
else
scanfiles(argv, 0)
end if

if fclose(stdout) then
err(1, "stdout")
end if

exit(rval)
end function


Rewritten from https://github.com/freebsd/freebsd/blob/master/bin/cat/cat.c

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