Changeset 43d9679


Ignore:
Timestamp:
Aug 11, 2024, 5:33:57 PM (3 months ago)
Author:
Peter A. Buhr <pabuhr@…>
Branches:
master
Children:
0e6aba06, 206ecae
Parents:
774c97e
Message:

move section from into to background

File:
1 edited

Legend:

Unmodified
Added
Removed
  • doc/theses/mike_brooks_MMath/background.tex

    r774c97e r43d9679  
    22
    33Since this work builds on C, it is necessary to explain the C mechanisms and their shortcomings for array, linked list, and string.
     4
     5
     6\section{Ill-typed expressions}
     7
     8C reports many ill-typed expressions as warnings.
     9For example, these attempts to assign @y@ to @x@ and vice-versa are obviously ill-typed.
     10\lstinput{12-15}{bkgd-c-tyerr.c}
     11with warnings:
     12\begin{cfa}
     13warning: assignment to 'float *' from incompatible pointer type 'void (*)(void)'
     14warning: assignment to 'void (*)(void)' from incompatible pointer type 'float *'
     15\end{cfa}
     16Similarly,
     17\lstinput{17-19}{bkgd-c-tyerr.c}
     18with warning:
     19\begin{cfa}
     20warning: passing argument 1 of 'f' from incompatible pointer type
     21note: expected 'void (*)(void)' but argument is of type 'float *'
     22\end{cfa}
     23with a segmentation fault at runtime.
     24Clearly, @gcc@ understands these ill-typed case, and yet allows the program to compile, which seems inappropriate.
     25Compiling with flag @-Werror@, which turns warnings into errors, is often too strong, because some warnings are just warnings, \eg unused variable.
     26In the following discussion, ``ill-typed'' means giving a nonzero @gcc@ exit condition with a message that discusses typing.
     27Note, \CFA's type-system rejects all these ill-typed cases as type mismatch errors.
     28
     29% That @f@'s attempt to call @g@ fails is not due to 3.14 being a particularly unlucky choice of value to put in the variable @pi@.
     30% Rather, it is because obtaining a program that includes this essential fragment, yet exhibits a behaviour other than "doomed to crash," is a matter for an obfuscated coding competition.
     31
     32% A "tractable syntactic method for proving the absence of certain program behaviours by classifying phrases according to the kinds of values they compute"*1 rejected the program.
     33% The behaviour (whose absence is unprovable) is neither minor nor unlikely.
     34% The rejection shows that the program is ill-typed.
     35%
     36% Yet, the rejection presents as a GCC warning.
     37% *1  TAPL-pg1 definition of a type system
    438
    539
Note: See TracChangeset for help on using the changeset viewer.