LogFAQs > #911136535

LurkerFAQs, Active DB, DB1, DB2, DB3, Database 4 ( 07.23.2018-12.31.2018 ), DB5, DB6, DB7, DB8, DB9, DB10, DB11, DB12, Clear
Topic List
Page List: 1
TopicUgh dealing with "strings" in C is such a pain.
1337toothbrush
10/25/18 10:48:24 AM
#16:


DevsBro posted...
1337toothbrush posted...
It can be tedious, but I like the flexibility.

C has fantastic conditional compilation features, is the main reason I have these few C source files.

The majority of my code for this is in Ada, which people like to crap on but once you get used to it, it's a great language for, well, preventing stuff like this topic. Like straight up if you define a

type Single_Digit is range 0..9

It won't let you assign 10 to it, which is pretty standard, but the nice thing is it also won't let you do this:

declare
X : Single_Digit := 6;
Y : Integer;
begin
Y := X;
end


Unless you either explicitly cast to an Integer or change the Single_Digit definition from a type to an Integer subtype.

It's great because it always makes sure you are sure you want to do what you're asking it to do and didn't just brainfart something.

That's great. I like my type system being as strong and static as possible. Compile-time checks are the best and their utility is lost on these python/javascript-slinging chucklefucks who think "all the things" should be written in those hacky languages.
---
... Copied to Clipboard!
Topic List
Page List: 1