Page 1 of 1
Createfile with high number - irritating warning
Posted: Sat May 12, 2012 8:34 am
by oakvalley
Please remove the error/debug stop or whatever it is that tells me "#File object number is very high (over 1000), are You sure of that ?" when trying to Createfile(1000,"c:\test.ini").
I find no use of such a limitation, it's plain ridiculous!
Let the user decide if he/she creates a file number of 999/1000. That's their worry, not PureBasic or did I miss something why there is a limit? Can't be a number base question either, then it should be $FF (256) or $FFFF (65536). At least then it would be understandable.
Re: Createfile with high number - irritating warning
Posted: Sat May 12, 2012 9:14 am
by Shield
It's just a warning. If you put DisableDebugger / EnableDebugger around it,
it will work without halting the program.
The only reason there is a warning is because it's a waste of memory if you use high numbers.
If you want to open a file with the number 100'000 then an array will be created with 100'000
elements, even if you only use one single file.
My recommendation is...just stop using those freaking IDs and use #PB_Any only,
it's much better and more flexible anyway.
Re: Createfile with high number - irritating warning
Posted: Sat May 12, 2012 11:32 am
by Little John
No, meaningful warnings like this one should not be removed!
Re: Createfile with high number - irritating warning
Posted: Sat May 12, 2012 1:42 pm
by Thorium
Go to compiler options, enable "Use Warning Mode" and set "Ignore Warnings".
However, as Shield pointed out you are wasting memory by using large numbers (and dont use all lower numbers at the same time).
Also i am not sure if high numbers can conflict with handles returned by using #PB_Any.
Re: Createfile with high number - irritating warning
Posted: Sat May 12, 2012 4:36 pm
by oakvalley
Ahh, ok. Ignore warnings can do for me. It was not for any serious release program, just a work tool I use a couple of times to produce some datafiles.
I just get confuzed when there is a question to be answered. It do say "if I'm really sure", and in my case, yes, I was 100% sure. The warning should probably spell out something else though. Sounds like an easter egg the way it's written now. Something more true to the cause should be "File numbers over 1000 will consume a lot of memory, please check your arguments." or "Due to OS limitations, please use #PB_Any or numbers below 1000." or even "File numbers above 1000 is not recommended, however, if needed, use the Ignore Warnings command to overrule it"....I can go on and on

Re: Createfile with high number - irritating warning
Posted: Sat May 12, 2012 5:31 pm
by netmaestro
The memory wasted by choosing high static object numbers is a good reason to question it to be sure, but it is a bit more complicated than that. The programmer may freely mix static #'s with #PB_Any and it is frequently done. Even if you don't do it you might be using a userlib that is using #PB_Any alongside your static numbers. #PB_Any will choose a high number from its pool and if you've chosen a high static number it has no way of knowing that it isn't creating an object number that is already being used. As the team has told us before, executing Is<your object here>() is relatively slow and so for the #PB_Any system to do it all the time would slow PB down unnecessarily.
That said, I agree with you that the language in the warning could be improved as it imparts no real information. This is a good request imho.
Re: Createfile with high number - irritating warning
Posted: Sun Oct 04, 2015 10:34 am
by Michael Vogel
Thorium wrote:Go to compiler options, enable "Use Warning Mode" and set "Ignore Warnings".
Have set the compiler option on PB 5.31, but the debugger still shows this message
Wouldn't it be fine to configure the limits (file handle maximum=1000, gadget ID maximum=10000 etc.) in the preferences? And I also kindly ask to change the debugger message from a question to a clear statement.