mcc,
@mcc@mastodon.social avatar

So: I'm not saying it's impossible to write safe C. But what I will say is that if someone claims to you it is possible to write safe C, that is prima facie evidence that they are, themselves, not a person who is capable of writing safe C

KevinMarks,
@KevinMarks@xoxo.zone avatar
bluGill,
bluGill avatar

@mcc Modern C++ is reasonably safe, but it is amazing how often people write C++98 even though C++11 added many easy to use features that make it easy to avoid most (not to be confused by all!) issues. However nothing stops you from writing code that is difficult to follow and has many opportunities for memory problems.

the_wiggler,

@mcc int main(){ return 1; }

Xucaen,
@Xucaen@mastodon.social avatar

@mcc

Programmer: of course my C code is completely safe!

Manager: that's great! Glad to hear it.

Other programmers: -.-

tshirtman,
@tshirtman@mas.to avatar

@mcc I was thinking "surely it's possible to write safe trivial programs in C", and then i remembered it's C, and i'm not so sure, maybe the standard hello world is unsafe in some circumstances. 😆

mcc,
@mcc@mastodon.social avatar

@tshirtman sincerely: if we consider the case of C++, C++ specifically, it is literally necessary to solve the halting problem in order to determine whether you have written a C++ program or not. Because the C++ language standard requires all loops to terminate, and if you ever violate this rule, the compiler is free to do anything at all without indicating a warning you that it has done so

tshirtman,
@tshirtman@mas.to avatar

@mcc that's an... Interesting design decision indeed. Can't say I wanted to try to write a C++ program ever again anyway, but good to know. 🥲

beeoproblem, (edited )
@beeoproblem@mastodon.gamedev.place avatar

@mcc I'm sure perfectly safe C is just as possible as solving the Halting Problem

mcc,
@mcc@mastodon.social avatar

@beeoproblem i'm sure there exist interesting subsets of the halting problem which are solvable

beeoproblem, (edited )
@beeoproblem@mastodon.gamedev.place avatar

@mcc More or less. My choice of metaphor is because I believe "prove this program is 100% safe" is equivalent in difficulty to solving the Halting Problem for the same program.

It may be doable for a specific program with some form of formal analysis but a general solution that works for all programs is likely impossible

tef,
@tef@mastodon.social avatar

@mcc i am willing to accept "i can write safe c but it's very expensive to write and goes through formal verification" but most software doesn't come with proofs, so

mcc,
@mcc@mastodon.social avatar

@tef The thing that concerns me most is people who are trying to express "it is possible to write C or C++ to a level of safety which is acceptable for certain applications" and word that as "it is possible to write safe C" and using the second phrase to describe the first situation is very concerning behavior

JamesWidman,
tef,
@tef@mastodon.social avatar

@mcc cf "don't roll your own crypto"

at least the people who can write crypto dissuade people from doing it

c0dec0dec0de,
@c0dec0dec0de@hachyderm.io avatar

@tef @mcc I slightly overstate my actual position here: https://hachyderm.io/@c0dec0dec0de/111856800940476470

glyph,
@glyph@mastodon.social avatar

@tef @mcc the people who can write safe C do not begin by attempting to write C, though, they know that the first thing to write is some TLA+

glyph,
@glyph@mastodon.social avatar

@tef @mcc to rephrase somewhat more punchily: it is possible to write safe C, but is not possible to write safe C by writing C

jond,
@jond@mastodon.social avatar

@mcc @tef Second'd! In my C/C++ work (power control systems) I try to be clear that it's possible to write safe-ENOUGH C/C++ if the system and processes are built to that end.

This means rules like "hardware MUST fail-safe by design and implementation; software verifiably MUST NOT be able to impact that; single points of failure MUST NOT exist for any control output", etc. etc. etc.

Safe enough, but we never believe it is safe. Difference between engineering and smashing hardware together.

  • All
  • Subscribed
  • Moderated
  • Favorites
  • random
  • ngwrru68w68
  • DreamBathrooms
  • thenastyranch
  • magazineikmin
  • InstantRegret
  • GTA5RPClips
  • Youngstown
  • everett
  • slotface
  • rosin
  • osvaldo12
  • mdbf
  • kavyap
  • cubers
  • megavids
  • modclub
  • normalnudes
  • tester
  • khanakhh
  • Durango
  • ethstaker
  • tacticalgear
  • Leos
  • provamag3
  • anitta
  • cisconetworking
  • JUstTest
  • lostlight
  • All magazines