Createfile with high number - irritating warning

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
User avatar
oakvalley
User
User
Posts: 77
Joined: Sun Aug 08, 2004 6:34 pm
Location: Norway
Contact:

Createfile with high number - irritating warning

Post 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.
Regards Stone Oakvalley
Currently @ PB 5.70
User avatar
Shield
Addict
Addict
Posts: 1021
Joined: Fri Jan 21, 2011 8:25 am
Location: 'stralia!
Contact:

Re: Createfile with high number - irritating warning

Post 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.
Image
Blog: Why Does It Suck? (http://whydoesitsuck.com/)
"You can disagree with me as much as you want, but during this talk, by definition, anybody who disagrees is stupid and ugly."
- Linus Torvalds
Little John
Addict
Addict
Posts: 4779
Joined: Thu Jun 07, 2007 3:25 pm
Location: Berlin, Germany

Re: Createfile with high number - irritating warning

Post by Little John »

No, meaningful warnings like this one should not be removed!
Thorium
Addict
Addict
Posts: 1305
Joined: Sat Aug 15, 2009 6:59 pm

Re: Createfile with high number - irritating warning

Post 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.
User avatar
oakvalley
User
User
Posts: 77
Joined: Sun Aug 08, 2004 6:34 pm
Location: Norway
Contact:

Re: Createfile with high number - irritating warning

Post 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

:-)
Regards Stone Oakvalley
Currently @ PB 5.70
User avatar
netmaestro
PureBasic Bullfrog
PureBasic Bullfrog
Posts: 8451
Joined: Wed Jul 06, 2005 5:42 am
Location: Fort Nelson, BC, Canada

Re: Createfile with high number - irritating warning

Post 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.
BERESHEIT
User avatar
Michael Vogel
Addict
Addict
Posts: 2797
Joined: Thu Feb 09, 2006 11:27 pm
Contact:

Re: Createfile with high number - irritating warning

Post 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.
Post Reply