[a / b / c / d / e / f / g / gif / h / hr / k / m / o / p / r / s / t / u / v / vg / vm / vmg / vr / vrpg / vst / w / wg] [i / ic] [r9k / s4s / vip] [cm / hm / lgbt / y] [3 / aco / adv / an / bant / biz / cgl / ck / co / diy / fa / fit / gd / hc / his / int / jp / lit / mlp / mu / n / news / out / po / pol / pw / qst / sci / soc / sp / tg / toy / trv / tv / vp / vt / wsg / wsr / x / xs] [Settings] [Search] [Mobile] [Home]
Board
Settings Mobile Home
/g/ - Technology

Name
Options
Comment
Verification
4chan Pass users can bypass this verification. [Learn More] [Login]
File
  • Please read the Rules and FAQ before posting.
  • You may highlight syntax and preserve whitespace by using [code] tags.

08/21/20New boards added: /vrpg/, /vmg/, /vst/ and /vm/
05/04/17New trial board added: /bant/ - International/Random
10/04/16New board for 4chan Pass users: /vip/ - Very Important Posts
[Hide] [Show All]


[Advertise on 4chan]


Without changing how people write code, how difficult is it to implement some kind of memory-safety feature (even if not accurate) in a C compiler, so it can show some kind of warning at least?

If it can't be done so easily at compile-time, then what about some kind of static-analysis tool that can inspect binaries for potential violations?
>>
File: 1768517676017532.gif (383 KB, 500x528)
383 KB
383 KB GIF
>>107875819
sounds good op
once you get that figured out, you should write a static analysis tool that can determine whether a program will stop or continue executing forever
>>
>>107875819
All you need is linear types.
>>
>>107875819
already exists
https://fil-c.org/
>>
>>107875819
just use the flag to enable ASAN.

Pro mode: enable MSAN.

Also enable UBSAN, if this works.

Too bad you can't have TSAN at same time too.
>>
>>107875819
>so it can show some kind of warning at least
rust doesn't do that either, it just crashes
>>
>>107875819
The best way is to write as much of your C code as possible without allocating memory.
https://nullprogram.com/blog/2018/06/10/
>>
>>107876443
This dude has all the best ideas and the worst coding style ever.
>>
just use valgrind
>>
>>107875819
It already warns for some stuff.
Warning for every single problem is both hard to retrofit and impossible to do without also warning for some stuff that's actually safe.

>>107876129
It does for bounds checks but not for most other things like use-after-free and data races. Those are caught at compile time.
>>
you only need heap memory when you dont know how much you need, or if you need massive amounts of it. there are reference counting pointer implementations for C, and the linux kernel even uses them. you should valgrind though at runtime to check for leaks.



[Advertise on 4chan]

Delete Post: [File Only] Style:
[Disable Mobile View / Use Desktop Site]

[Enable Mobile View / Use Mobile Site]

All trademarks and copyrights on this page are owned by their respective parties. Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.