LogFAQs > #911131458

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.
DevsBro
10/25/18 8:40:58 AM
#14:


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.
---
53 LIII 0b110101
p16 0x35
... Copied to Clipboard!
Topic List
Page List: 1