I like the stronger checks of the X# compiler

This forum is meant for questions and discussions about the X# language and tools
Post Reply
User avatar
wriedmann
Posts: 3775
Joined: Mon Nov 02, 2015 5:07 pm
Location: Italy

I like the stronger checks of the X# compiler

Post by wriedmann »

Hi,

compiling this code:

Code: Select all

nLen := oParameter:Count - 1
for nI := 0 upto nLen                                                   
  cKey:= cKey
  cParameter:Replace( "@" + cKey + "@", oParameter[cKey] )
next
gave me the compiler warnings

warning XS1717: Assignment made to same variable; did you mean to assign something else?
warning XS0165: Use of unassigned local variable 'cKey'

and in fact, the compiler is right!

Thank you for discovering such (stupid) errors!

Wolfgang
Wolfgang Riedmann
Meran, South Tyrol, Italy
wolfgang@riedmann.it
https://www.riedmann.it - https://docs.xsharp.it
User avatar
Chris
Posts: 4961
Joined: Thu Oct 08, 2015 7:48 am
Location: Greece

I like the stronger checks of the X# compiler

Post by Chris »

Hi Wolfgang,

Actually the X# compiler found this exact problem also in my old VIDE code, about a dozen times! In all cases it was of course bugs in my code that were not caught by the vulcan compiler earlier and were causing incorrect runtime behavior, was embarrassing to realize this after all that time :-)

There were more similar problems in my code (about 135k lines) that were pointed out by the X# compiler, I want to find some time and write a blog article about this.

Chris
Chris Pyrgas

XSharp Development Team
chris(at)xsharp.eu
User avatar
wriedmann
Posts: 3775
Joined: Mon Nov 02, 2015 5:07 pm
Location: Italy

I like the stronger checks of the X# compiler

Post by wriedmann »

Hi Chris,

new and stronger compilers help us programmers to write more stable programs - I like them.

Thanks to your team for this check!

Wolfgang
Wolfgang Riedmann
Meran, South Tyrol, Italy
wolfgang@riedmann.it
https://www.riedmann.it - https://docs.xsharp.it
Post Reply