Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
jberryman
GHC
Commits
fda7f6a2
Commit
fda7f6a2
authored
Jan 23, 1999
by
sof
Browse files
[project @ 1999-01-23 17:40:07 by sof]
Tag all 'foreign import's as being unsafe.
parent
dddefa4e
Changes
1
Show whitespace changes
Inline
Side-by-side
ghc/lib/std/System.lhs
View file @
fda7f6a2
...
...
@@ -98,7 +98,7 @@ getEnv name = do
else ioError (IOError Nothing NoSuchThing "getEnv"
("environment variable: " ++ name))
foreign import ccall "libHS_cbits.so" "getenv" primGetEnv :: PrimByteArray -> IO Addr
foreign import ccall "libHS_cbits.so" "getenv"
unsafe
primGetEnv :: PrimByteArray -> IO Addr
\end{code}
Computation $system cmd$ returns the exit code
...
...
@@ -124,7 +124,7 @@ system cmd = do
-1 -> constructErrorAndFailWithInfo "system" cmd
n -> return (ExitFailure n)
foreign import ccall "libHS_cbits.so" "systemCmd" primSystem :: PrimByteArray -> IO Int
foreign import ccall "libHS_cbits.so" "systemCmd"
unsafe
primSystem :: PrimByteArray -> IO Int
\end{code}
@exitWith code@ terminates the program, returning {\em code} to the program's caller.
...
...
@@ -142,7 +142,7 @@ exitWith (ExitFailure n)
primExit n
ioError (IOError Nothing OtherError "exitWith" "exit should not return")
foreign import ccall "libHS_cbits.so" "exit" primExit :: Int -> IO ()
foreign import ccall "libHS_cbits.so" "exit"
unsafe
primExit :: Int -> IO ()
exitFailure :: IO a
exitFailure = exitWith (ExitFailure 1)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment