#include_once is case sensitive!

I spent the entire morning trying to solve this. I found out that #include_once is case sensitive.

So the following code will work:

#include_once <testzigutils.afl>
#include_once <testzigutils.afl>
#include_once <testzigutils.afl>

However this will not work, it witll give error "unexpected USER_FN, expecting IDENTIFIER" :

#include_once <testzigutils.afl>
#include_once <TESTzigutils.afl>
#include_once <testzigutils.afl>

I thought to share it with you.

2 Likes

Yes and no. It is NOT case sensitive considering file name alone (because file names in Windows aren't) so it does not matter at all if you #include "Filename.afl" or #include "FILEnaMe.afl" both point to same file. What is case sensitive is the "ONCE" part. If you use "once" variation it searches the literal string if it was already used in previous include. Exact searches are a whole lot faster than case-insensitive searches that have to handle all languages special characters.
Since you used different strings, it included the file again because the name used in previous #include_once call was different. Your #included file contains function definitions and you got the error because function was defined twice. Therefore it is good habit to use lowercase in #include.

1 Like

@Tomasz

Maybe in the next version you can convert internally the filenames to all upper or all lower case, so that this mistake (my mistake) does not happen to anyone else.

Yes I think I will do that.

2 Likes