HackerTrans
TopNewTrendsCommentsPastAskShowJobs

oecumena

no profile record

Submissions

C++: Zero-cost static initialization

cofault.com
84 points·by oecumena·12 เดือนที่ผ่านมา·58 comments

[untitled]

1 points·by oecumena·ปีที่แล้ว·0 comments

Formal verification of the long division algorithm

cofault.com
2 points·by oecumena·ปีที่แล้ว·1 comments

[untitled]

1 points·by oecumena·2 ปีที่แล้ว·0 comments

Don't lose your file (descriptors): escrow library

github.com
1 points·by oecumena·2 ปีที่แล้ว·1 comments

comments

oecumena
·6 เดือนที่ผ่านมา·discuss
'The Lobster Programming Language (strlen.com)' is duplicated.
oecumena
·ปีที่แล้ว·discuss
Analytical series for data types.
oecumena
·ปีที่แล้ว·discuss
Manual derivation of Hoare-triples for the long division algorithm verification.
oecumena
·2 ปีที่แล้ว·discuss
Still won't work. The Standard explicitly specifies that FILE type includes all stream attributes, including position indicator:

    ISO/IEC 9899:TC3 7.19.1 
    FILE
    which is an object type capable of recording all the information needed to control a
    stream, including its file position indicator, a pointer to its associated buffer (if any), an
    error indicator that records whether a read/write error has occurred, and an end-of-file
    indicator that records whether the end of the file has been reached;

Hence no stream can be longer than 2^(sizeof(FILE)*CHAR_BIT) (6.2.6.1 guarantees that objects of any type cannot have "hidden" bits of state not accounted by sizeof()).
oecumena
·2 ปีที่แล้ว·discuss
Sizes of stdio FILE streams are still limited, because of ftell: the standard requires that file position (as measured from the beginning of the file) is representable as long or off_t.

You can advance an argument that even though each stream is limited, you can have an infinite number of streams, but this does not work, because stream name is a string, and there is only finite number of possible strings and the standard library does not contain chdir().
oecumena
·2 ปีที่แล้ว·discuss
For any C program there is a number N, that depends on the program, compiler, architecture, etc., but does not depend on the program input, such that the program won't be able to access more than N bits of state at any moment in any of its possible executions. Hence, the program is equivalent to a finite state automaton.
oecumena
·2 ปีที่แล้ว·discuss
C is definitely not Turing complete. The standard library provides no escape, because file sizes are also limited (due to ftell (3)), and there is no chdir in the C standard library, so the total number of files is also limited. I have a recollection of an attempt to construct a possible Turing-complete interpretation of the C standard involving recursion and va_arg, but I don't think it went anywhere.
oecumena
·2 ปีที่แล้ว·discuss
I did another one back in 2001: https://ldoor.sourceforge.net/ .
oecumena
·2 ปีที่แล้ว·discuss
File descriptor escrow library: provides an interface to send process file descriptors to a separate process ("escrow daemon", "escrowd"). The descriptors can be retrieved later by the sender or another process.