Search found 1165 matches

by stylin
May 23, 2015 13:36
Forum: General
Topic: Position item in an array larger than 3D
Replies: 94
Views: 6343

Re: Position item in an array larger than 3D

scope const XSIZE = 3 const YSIZE = 2, YPITCH = XSIZE dim array(YSIZE-1, XSIZE-1) as integer => {{0,1,2},{3,4,5}} print "2 dimensions:" for i as integer = 0 to YSIZE*XSIZE - 1 var y = (i ) \ YPITCH var x = (i - y*YPITCH) print using "i:# y:# x:# array(y,x):#"; i; y; x; array(y, ...
by stylin
May 17, 2015 0:30
Forum: Community Discussion
Topic: Dim Byref syntax
Replies: 134
Views: 11666

Re: Dim Byref syntax

@grindstone Hi, it would not only alias named objects, but also things like, dim byref i as integer = *(some_complex_pointer_math) Other than superficial syntactic sugar, references give you a few guarantees that pointers don't: ⋅ You're dealing with an actual object. Pointers can ...
by stylin
May 16, 2015 17:28
Forum: Community Discussion
Topic: Dim Byref syntax
Replies: 134
Views: 11666

Re: Dim Byref syntax

I like the first syntax as well, very excited to see the development of this. :)
by stylin
May 15, 2015 16:56
Forum: Tips and Tricks
Topic: Text Scrambling
Replies: 6
Views: 1045

Re: Text Scrambling

Cool, glad you got some new things to think about. :) One of my favorite NES games uses a cipher like the ones we've posted to encrypt the passwords it gives you when you save the game. It was lots of fun to mess around with the debugger and figure out how the game was doing that, I even wrote a FB ...
by stylin
May 15, 2015 2:50
Forum: Tips and Tricks
Topic: Text Scrambling
Replies: 6
Views: 1045

Re: Text Scrambling

Hi. Randomize is used to seed the random number generator; a different seed will tell Rnd to produce a different sequence of random numbers. But if you use the same seed (our key ), Rnd will produce the same sequence. When you have time, look into hash functions; they take a stream of characters and...
by stylin
May 14, 2015 23:47
Forum: Tips and Tricks
Topic: Text Scrambling
Replies: 6
Views: 1045

Re: Text Scrambling

Hi, good observation about the wrap-around effect. :) If you want to play around with more ways to encrypt text, this is a good place to start: http://en.wikipedia.org/wiki/Cryptography http://en.wikipedia.org/wiki/Stream_cipher http://en.wikipedia.org/wiki/RC4 For example, here's a simple synchrono...
by stylin
May 14, 2015 11:06
Forum: Tips and Tricks
Topic: Josephus problem - Linked list example
Replies: 9
Views: 1924

Re: Josephus problem - Linked list example

Hi, here's another linked list version. const N = 41 const K = 3 const S = "The prisoner standing at position ## is eliminated. ## prisoner(S) eliminated." dim nextp(1 to N) as integer for i as integer = 1 to N-1 nextp(i) = i + 1 next i nextp(N) = 1 var eliminated = 0, skipped = 0 var p = ...
by stylin
May 13, 2015 0:17
Forum: Beginners
Topic: FreeBASIC variable initialization
Replies: 14
Views: 2878

Re: FreeBASIC variable initialization

RockTheSchock, I didn't know about the VAR keyword. Now I have tried it. This is almost what I want. But the VAR keyword is redundant. Why do I have to type four additional characters 'var '? The general idea is that it's better to be explicit with your intent. The compiler always knows the first t...
by stylin
Feb 07, 2015 7:17
Forum: Community Discussion
Topic: [offtopic]I'm old :-)
Replies: 38
Views: 4902

Re: [offtopic]I'm old :-)

Happy belated half-century D.J.Peters :)
by stylin
Jul 20, 2013 14:21
Forum: General
Topic: Function Ptr inside Function not recognised by ... [solved]
Replies: 3
Views: 502

Re: Function Ptr inside Function not recognised by compiler

Just quickly looking over the code, _GetDriverVersion needs to be declared with the Shared keyword so that it can be accessed within procedures.

http://www.freebasic.net/wiki/wikka.php ... eyPgShared
by stylin
Jun 27, 2013 11:53
Forum: General
Topic: Questions on inheritance in FreeBASIC
Replies: 337
Views: 48395

Re: Questions on inheritance in FreeBASIC

You could skip the run-time type checks by using some helper classes: ' two interfaces type Source extends Object declare abstract function ReadByte () as byte end type type Sink extends Object declare abstract sub WriteByte ( byval x as byte ) end type ' forward declaration type StringStream_ as St...
by stylin
May 07, 2011 2:20
Forum: Beginners
Topic: TYPE, and redim array in them
Replies: 15
Views: 3062

badidea, nice codes. Sometimes an allocator will allocate a little more memory at the beginning of the array for housekeeping info (sizes, ptrs to internal memory blocks, etc.) and simply return the address of the user data immediately following this housekeeping info. May be something to look into ...
by stylin
May 06, 2011 21:13
Forum: Projects
Topic: LLVM Headers
Replies: 4
Views: 1023

I cannot speak for the C API, but playing around with the C++ interface for a time was very fun and it seems well designed.
by stylin
May 06, 2011 17:03
Forum: General
Topic: VAL - 27 kb ?
Replies: 14
Views: 1535

Ah, my apologies, I misunderstood the nature of the post.
by stylin
May 06, 2011 16:53
Forum: General
Topic: VAL - 27 kb ?
Replies: 14
Views: 1535

Hi, VANYA. This code produces the expected result for me (FreeBASIC Compiler - Version 0.21.1 (08-11-2010) for win32 (target:win32)): Var hh=Val("55") print hh ' prints 55 To see what version you are using, run fbc -version from a console window. Perhaps there is a problem in anoth...

Go to advanced search