Deleted
Deleted Member
Posts: 0
|
Post by Deleted on May 13, 2015 10:31:06 GMT 1
I've tried to insert some C code to my BaCon programs, but I've experienced problems with the newest BaCon version (3.0.4 beta). For example, when I run this code:
y = 0 for x = 1 to 10000 usec for (y = 1; y < 10000; y++) { printf("%d", y); } end usec next
I get an error:
It may have something to do with using lowercase letter, but I may be wrong.
|
|
|
Post by Pjot on May 13, 2015 11:58:19 GMT 1
Hi Tomaaz,
Well, your suspicion is right - the '-z' flag will define a macro for the C Preprocessor which maps the 'for' to a 'FOR'. In such a situation, the resulting code will look like this:
y = 0 FOR x = 1 to 10000 USEC FOR (y = 1; y < 10000; y++) { printf("%d", y); } END USEC NEXT
This generates the error you mention. Because the C compiler does not know what to do with 'FOR'.
Note that the following program does work (not using small letters for BaCon keywords):
y = 0 FOR x = 1 TO 10000 USEC for (y = 1; y < 10000; y++) { printf("%ld", y); } END USEC NEXT
BR Peter
|
|
Deleted
Deleted Member
Posts: 0
|
Post by Deleted on May 13, 2015 14:40:32 GMT 1
Yes, it does, however one needs to remember not to use -z option while converting. I use it with Geany by default and a version without small letters for BaCon didn't work, too. Removing -z fixed the problem. Thanx Peter!
|
|