←back to thread

327 points AareyBaba | 4 comments | | HN request time: 0.001s | source
Show context
time4tea ◴[] No.46184345[source]
a = a; // misra

Actual code i have seen with my own eyes. (Not in F-35 code)

Its a way to avoid removing an unused parameter from a method. Unused parameters are disallowed, but this is fine?

I am sceptical that these coding standards make for good code!

replies(11): >>46184442 #>>46184460 #>>46184571 #>>46185232 #>>46185373 #>>46186276 #>>46186377 #>>46186457 #>>46186510 #>>46186705 #>>46189488 #
ivanjermakov ◴[] No.46184571[source]
Zig makes it explicit with

    _ = a;
And you would encounter it quite often because unused variable is a compilation error: https://github.com/ziglang/zig/issues/335
replies(2): >>46185933 #>>46185991 #
ErroneousBosh ◴[] No.46185933[source]
Golang is exactly the same.

It's extremely annoying until it's suddenly very useful and has prevented you doing something unintended.

replies(2): >>46186034 #>>46186865 #
bluecalm ◴[] No.46186034[source]
I fail to see how a warning doesn't achieve the same thing while allowing you to iterate faster. Unless you're working with barbarians who commit code that complies with warnings to your repo and there is 0 discipline to stop them.
replies(3): >>46188913 #>>46189743 #>>46191081 #
1. treyd ◴[] No.46188913[source]
You're not supposed to question the wisdom of the Go developers. They had a very good reason for making unused variables be an unconfigurable hard error, and they don't need to rigorously justify it.
replies(1): >>46191136 #
2. FieryMechanic ◴[] No.46191136[source]
Warnings are often ignored by developers unless you specifically force warnings to be compile errors (you can do this in most compiler). I work on TypeScript/C# code-bases and unless you force people to tidy up unused imports/using and variables, people will just leave them there.

This BTW can cause issues with dependency chains and cause odd compile issues as a result.

replies(1): >>46203419 #
3. account42 ◴[] No.46203419[source]
> Warnings are often ignored by developers unless you specifically force warnings to be compile errors (you can do this in most compiler).

Not my experience. Find better managers.

replies(1): >>46203625 #
4. FieryMechanic ◴[] No.46203625{3}[source]
>Not my experience

The point being conveyed is your experience is not representative of what commonly occurs. I have worked as a contractor in a number of different orgs both small, large, private and public and more often than not unless you force people to fix these things, they won't.

> Find better managers.

How about you and others with similar attitudes realise that the world isn't perfect and sometimes you have to work with what you got.

Do you think I haven't been looking for a new position? Most of the jobs in my area are going to be more of the same.