Compiler Const bug?

Coding and general discussion relating to the compiler

Moderators: David Barker, Jerry Messina

SHughes_Fusion
Posts: 219
Joined: Wed Sep 11, 2013 1:27 pm
Location: Chesterfield

Re: Compiler Const bug?

Post by SHughes_Fusion » Thu Oct 29, 2015 3:23 pm

Good points - I use EE.Write as it seemed meant to be the 'generic' way to do things and it would automatically choose to write it as a longword. You are correct though that if I specified the data size to write it would work OK. I usually avoid this if I can as it makes changing the type prone to error.

As for avoiding floats, that is the reason for the TemperatureMultiplier. However, when declaring the consts I find it easier to use 'real world' values. In this case of the ReadyThreshold we may decide to tighten this to 2.5 (degrees C). As I'm working in 64ths of a degree internally this will still result in an integer value, but I'd like to be able to declare it in a way that makes sense to someone else reading the code.

The alternative is of course to just calculate 2.5 * 64 manually and set the const to this value then add a comment to explain why, but this isn't as convenient.

I'd not noticed the drop-down, thanks for pointing it out. Is there any way to get it to highlight the const you are currently editing? Some of my programs have many tens, probably hundreds of consts so keeping track isn't so easy.

Post Reply