Search found 5352 matches

by counting_pine
Nov 13, 2018 14:39
Forum: Beginners
Topic: About mod and then
Replies: 5
Views: 146

Re: About mod and then

You could argue that 'mod' should always be non-negative, and '\' should always round downwards. I'd probably prefer it that way. But it is the way it is because that's what people expect now, and it's what QBASIC did, and it's how x86 processors do it. Either way, as long as the identity 'a = b * (...
by counting_pine
Nov 12, 2018 14:18
Forum: Beginners
Topic: About mod and then
Replies: 5
Views: 146

Re: About mod and then

All you need to remember with Mod is that the result has the same sign as the input. (Except when the result is zero.)

(This means the result doesn't depend on the sign of the second operand at all.)
by counting_pine
Nov 10, 2018 15:28
Forum: Community Discussion
Topic: Resignation
Replies: 74
Views: 1901

Re: Resignation

Speaking for myself, while I regularly contribute in the FB forums, I don't always enjoy moderating in it. I also find I don't tend to keep up with the longer threads, and that's usually where things get heated, so I feel like it's difficult for me to step in. I often don't feel I know the best thin...
by counting_pine
Nov 09, 2018 13:22
Forum: General
Topic: [Code question] variables and unwanted results.
Replies: 10
Views: 282

Re: [Code question] Self referencing variables: Human error or bug ?

Hi Krieger, welcome to the forum! Subs/Functions can modify parameters, if they are passed by reference ('byref'), rather than by value ('byval'). In FreeBASIC, the default used to be that all parameters where passed byref by default, but at some point the default changed so that scalars (integer/fl...
by counting_pine
Nov 04, 2018 18:38
Forum: DOS
Topic: Custom C64 eumlator crashes in FreeDOS
Replies: 10
Views: 248

Re: Custom C64 eumlator crashes in FreeDOS

Does the stack size make a difference? I wouldn't have expected it to, since it shouldn't be allocating on the stack. If allocating 560MB works, then guess other things to try then are: - try smaller amounts of memory. Is there a point below which it succeeds? - print something after the two 'new' s...
by counting_pine
Nov 04, 2018 17:41
Forum: Community Discussion
Topic: New website
Replies: 37
Views: 4320

Re: New website

OK, regarding the three-character search limit - it can be done but involves changing the search backend or the SQL configuration on the server. I could try the former, but I don't know what consequences it will have on things like server load, processing speed, internal cache use... With [tt], it u...
by counting_pine
Nov 04, 2018 17:25
Forum: DOS
Topic: Custom C64 eumlator crashes in FreeDOS
Replies: 10
Views: 248

Re: Custom C64 eumlator crashes in FreeDOS

Try the following:

Code: Select all

type T
    a(560e6) as byte
end type
var p = new T
print p
delete p
If this code fails, there's not much you can do.
by counting_pine
Nov 02, 2018 15:54
Forum: General
Topic: Where have I gone wrong
Replies: 192
Views: 4555

Re: Where have I gone wrong

Firstly, let me just resay that it's hard to parse '*row[4]', and so after spending a couple of minutes experimenting, I would strongly advise using '*(row[4])' for unambiguity. Since 'row' is a zstring ptr ptr, 'row[4]' is a zstring ptr. Ordinarily, dereferencing a zstring ptr will give a zstring, ...
by counting_pine
Nov 02, 2018 14:58
Forum: General
Topic: exact calc whit fractor's [ breuken ]
Replies: 1
Views: 55

Re: exact calc whit fractor's [ breuken ]

Hi. Is a fractor another name for a fraction? I don't know if you're looking for help with the code, but the gcd() function may have problems with non-positive numbers, or where one number is much larger than the other (e.g. print 'gcd(2e9, 1)'). You can speed up the latter cases by using Mod, and t...
by counting_pine
Nov 02, 2018 14:47
Forum: General
Topic: Where have I gone wrong
Replies: 192
Views: 4555

Re: Where have I gone wrong

get one string from array: (*ZString Ptr)[idx1] or, to get at a single Char: ZString[idx1][idx2] (byref access) This has worked ever since, through from ver. 0.24.0 to current (incl. 1.05.0). (I've not yet tested the 1.06.0 versions, 32/64.) As is, those obviously don't compile. But given sensible ...
by counting_pine
Nov 02, 2018 13:30
Forum: General
Topic: Where have I gone wrong
Replies: 192
Views: 4555

Re: Where have I gone wrong

Thanks for the thread link. I see that dkl calls this a shortcut, but like many shortcuts, it's basically a case of the compiler silently guessing at what you mean. That's helpful when there's only one intuitive meaning, but this thread shows that there are at least two potentially intuitive meaning...
by counting_pine
Nov 02, 2018 12:43
Forum: General
Topic: strange bug, FB win64
Replies: 9
Views: 199

Re: strange bug, FB win64

If you can trigger an internal error in the latest version of MinGW's GCC, the developers would probably appreciate knowing about it. We might be able to narrow it down if you can provide the FB source code, the generated C file (fbc -R), and the GCC command line (fbc -v). (You can Pastebin or simil...
by counting_pine
Nov 02, 2018 12:34
Forum: General
Topic: Where have I gone wrong
Replies: 192
Views: 4555

Re: Where have I gone wrong

Sometimes I think we need a "known bugs" section on wiki pages, to distinguish between buggy and intended beheviour..
Typically quirks like that should best be considered as Undefined Behaviour, or at least, implementation-defined. Not written into the specification.
by counting_pine
Nov 02, 2018 10:56
Forum: General
Topic: Where have I gone wrong
Replies: 192
Views: 4555

Re: Where have I gone wrong

I've made a bug report at https://github.com/freebasic/fbc/issues/111 . valint() is usually better to use than val() when you want an Integer result, so there are no intermediate floating-point values. Now have to ask what is quicker Select case or if else end if? You should find the GCC backend can...
by counting_pine
Nov 02, 2018 10:31
Forum: General
Topic: Where have I gone wrong
Replies: 192
Views: 4555

Re: Where have I gone wrong

It looks like FB is treating a deref+assign to int on a zstring ptr, the same way it would a ubyte ptr. dim i as integer, pz as zstring ptr, pb as ubyte ptr pz = @"Hi": pb = pz i = *pb: print i, *pb i = *pz: print i, asc(*pz) I suspect the underlying problem is that a zstring ptr is basica...

Go to advanced search