09-29-2023, 03:26 AM
foo my gaad!
BASFILE - Converts small files to BAS code.
|
09-29-2023, 03:26 AM
foo my gaad!
09-29-2023, 05:14 AM
Compile that code in M$QuickBASIC you get an error at the second line.
(09-29-2023, 02:31 AM)SMcNeill Wrote:(09-28-2023, 07:16 PM)RhoSigma Wrote:(09-28-2023, 06:51 PM)SMcNeill Wrote: You guys make me cry, reusing A for both string and long in the same function. Well Steve, it's your way to turn a made statement into something completely different. We originally were talking about SIMPLE variables, not about TYPEs, its elements or even program labels, those have their own different namespace. The made statement was about same named SIMPLE VARIABLES, that's it. But to answer your question, my guess is that the error already happens in the IDE/Compiler when the code is translated into C/C++. I've seen many places in the QB64pe.bas source which handles variable typing and never got a clue what's exactly done in there. A computer NEVER does what we expect, it simply is doing what's PROGRAMMED.
GuiTools, Blankers & other Projects:
https://qb64phoenix.com/forum/forumdisplay.php?fid=32 Libraries & useful Functions: https://qb64phoenix.com/forum/forumdisplay.php?fid=23
The truth to the glitch in the little program I posted is sooo simple, you'd never see it:
PRINT "Foo"; foo.foo Quote:Now, I offer a cookie to the first person who can decipher what the heck is going on here, and explain WHY foo.foo is printing out its own "Foo" for us, when the last assigned command for it before the PRINT statement is a very simple: So why's it printing a "Foo" on the screen? WE TOLD IT TO!! The glitch is simply in the PRINT statement itself, with us having it print a literal "Foo" that wasn't supposed to be in there. The issue that arises however, is that once you start checking for all those foo + suffixes, you get lost in trying to track which is which and what the heck they're all supposed to represent, and it's dang easy to just skim over a literal value of "Foo" in quotes, and not even notice it. The labels and types just help exacerbate the issue, but you've got to admit: Even without those, just tracking each suffix value for that same variable, and keeping it straight as a separate entity of all the others with the same name, takes more work, effort, and concentration on the part of the programmer. If I'm going to be debugging code, I'd much rather just debug the variable A, rather than having to sort out A from A&, a%, A&&, A#, A~` and A$3. Heck, I get completely lost when I see folks type something like DIM A$3, A3$ -- which are two different beasts completely, and both perfectly valid! Now, I'm not saying doing such things isn't possible. In fact, if that's someone's personal style and they can keep it all straight and never have any issues with it, more power to them! It's just the type of code that tends to make me cry and pull my hair out whenever someone pops up on the forum or in an email and says, "Hey, can you help me sort this out?" And apologies to @Dav for hijacking his post with my own personal coding issues. /blush
09-29-2023, 10:07 AM
Quote:And apologies to @Dav for hijacking his post with my own personal coding issues. /blush The blame is not as much yours as it is mine. I only proposed a "DIM" line in case somebody is impatient enough to try "BASFILE" but has to use `OPTION _EXPLICIT`. There are quite a few around here including myself.
09-29-2023, 10:27 AM
All code should be written with OPTION EXPLICIT.
Tread on those who tread on you
09-29-2023, 11:18 AM
(09-29-2023, 10:07 AM)mnrvovrfc Wrote:Quote:And apologies to @Dav for hijacking his post with my own personal coding issues. /blush No worries, it's Dav's own Forum on the "Prolific Programmers" board here, so he has admin rights here an can delete the whole mess we created. Sorry Dav
GuiTools, Blankers & other Projects:
https://qb64phoenix.com/forum/forumdisplay.php?fid=32 Libraries & useful Functions: https://qb64phoenix.com/forum/forumdisplay.php?fid=23
Hey, I'm kinda tickled my little area has some traffic.
@mnrvovrfc: Good suggestion adding the DIM line. The goal is to output a portable FUNCTION people can add to any program easy, and that will help make it so. I admit I haven't used OPTION EXPLICIT before, and didn't really understand what it was for until I heard Fellippe talk about it in a podcast. I think it will help me prevent coding errors, so I'm going to get to know it. Also, I am very bad about naming variables well (I rush coding) so that is something I will try to work on. I think these Base91 functions are working without errors. I scrapped the ones I came up with because they kept corrupting data, so I went back to these I adapted from sources on the internet in another language. These seem to work ok. These haven't been speed up using the MID$ technique yet, will do that next. Will have to do something different than the Base85 function do. Since Base91 encoded output size is not 100% predictable like Base64 & Base85 output is (it can fluctuate according to input data), I will have to save the original input size in the B91 encoded data, and then strip it out during decoding. - Dav Code: (Select All)
09-29-2023, 03:11 PM
I might have to make me another GUI frontend for your code, Dav! No promises, though. I rarely code for fun anymore. But I think it would be nice to not only make a GUI frontend but make it have a radio button for Base64, Base85, and Base91 for both BIN2BAS and PIC2MEM.
Tread on those who tread on you
Another update to BASFILE.
I made it a dialog only app, there's no main window. This hopefully makes it more user friendly. I also added the DIM line that was suggested to make it OPTION _EXPLICIT friendly. Also it now saves the encoded filename in the output function. Probably this will be the last update for a while unless there's an error that needs corrected. I have tested it in Windows & Linux. I would appreciate any feedback from a Mac user if it works OK or not. Thanks! @SpriggsySpriggs, sure go ahead. You may use them however you want. - Dav |
« Next Oldest | Next Newest »
|