Is useless code a problem?

Software questions and issues with the FV-1

Moderator: frank

Post Reply
livingston
Posts: 131
Joined: Sun Nov 15, 2009 3:37 pm
Location: New Orleans, LA US

Is useless code a problem?

Post by livingston »

Sometimes in the process of developing a program, it's easier to leave in a bunch of useless code and just disable it, than to remove it and completely restructure the program.

Is there any reason that this would be bad (aside from readability) - for example, does a longer program create more latency or anything?
frank
Posts: 1244
Joined: Wed Oct 19, 2005 12:26 pm
Contact:

Post by frank »

There is no harm at all in leaving it, FV-1 steps through all 128 program locations every sample period so it takes no more time to execute a program of 128 instructions than a program of 1.

If the unused code is commented out then it will be stripped by the assembler in any case, if you are leaving it in line but simply not summing the result into the final output then it could be like a flag you could recognize if someone lifts your code. Highly unlikely they would put in exactly the same useless code and produce the exact same hex file.

If 2 people to make a 500mS delay the hex could be identical (assembler will always start a memory location 0, etc.) but the sources different (different names for memory block, etc.). But unused test code in the middle of a program? Highly unlikely they would be the same hex file.
Frank Thomson
Experimental Noize
Post Reply