I am finding my working code is producing a lot of compiler warnings.
The code is working OK so should I take any notice of these warnings?
I have distilled the most common ones to the test cases below:
test1 says "x has no value". I've got a hazy memory that there is some
issue with a function returning a value that may not be valid outside
the scope of the function. Is it something like that? Although the code
does run as I would expect so should I make some change just to
eliminate the warning?
Why does test3 produce an warning and not test2?
I have commented out test3 because the "The variable % is defined but
never used." warning masks out the "x has no value" warning.
Martin
)abbrev package MJBTEST1 MJBTest1
NNI==> NonNegativeInteger
++ code to show compiler warnings
MJBTest1() : with
test1 : (im:List NNI) -> List NNI
++ test1: x has no value
test2 : (List NNI) -> List NNI
++ no warnings
test3 : (List NNI) -> List NNI
++ Caught STYLE-WARNING:
++ The variable % is defined but never used.
== add
test1(im:List NNI) : List NNI ==
x:List NNI := [4,5,6]
for p in im repeat
if p=3 then
x := concat(x,p)
x
test2(a : List NNI) : List NNI ==
b : List NNI := []
for a1 in a repeat
b := concat(b,a1+1)
b
-- test3(c : List NNI) : List NNI ==
-- d : List NNI := []
-- for c1 in c repeat
-- d := concat(c1+1,d)
-- d
--
You received this message because you are subscribed to the Google Groups "FriCAS -
computer algebra system" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion visit
https://groups.google.com/d/msgid/fricas-devel/fcdeba1d-4488-4469-8ee1-d37f2ac43fea%40martinb.com.