Search found 2910 matches

by Richard
Jul 08, 2007 5:41
Forum: Beginners
Topic: strange bug
Replies: 5
Views: 1280

If you change your “Endif” keywords to “End If” you can use the FBIde view/format/indent feature to check your structure. At the end you define variables of type bcdfloat. By insulating them with q1 and q2 it fixes the problem with x. It looks like when str2bcd writes to y it wrongly overwrites the ...
by Richard
Jul 08, 2007 0:09
Forum: Beginners
Topic: strange bug
Replies: 5
Views: 1280

Minimise the problem. The bug appears not to be dependent on s, so use s=”1” Regarding: #define NUM_BYTES 12 'Number of bytes per mantissa The bug disappears when NUM_BYTES is 7 or less, independent of s=”???”. So ask what is dependent on NUM_BYTES size = 8 or more. Your turn again.
by Richard
Jul 04, 2007 13:27
Forum: General
Topic: Some rotation questions
Replies: 3
Views: 1301

Rotations are best done by vector rotation with a complex multiply, computation of coordinates are best done in double (not integer). Have fun. ' Rotate a triangle about a centre Screenres 800, 600, 32 Dim As Integer i Dim As Double x(1 To 3), y(1 To 3) ' original corner points Dim A...
by Richard
Jun 23, 2007 4:51
Forum: General
Topic: Line Input, Eof() – linefeed weird bug?
Replies: 8
Views: 2876

Here is a sub to replace Line Input # ' emulate " Line Input #h, s " with " LineInput (h, s) " ' must first open file with Open "filename.ext" For Binary As #h Sub LineInput( Byval handle As Integer, Byref s As String) Const As Integer LF = 10, CR = 13 D...
by Richard
Jun 22, 2007 21:21
Forum: General
Topic: Line Input, Eof() – linefeed weird bug?
Replies: 8
Views: 2876

This code should convert LFs to CRLFs. Dim As String f1 = "Inputfile.ext" ' the file to convert Dim As String f2 = "temp.txt" ' a temporary scratch file Dim As String*1 char, last Dim As Integer LF = 10, CR = 13 Open f1 For Binary As #1 Open f2 For Binary As #2 Do Until Eof(1...
by Richard
Jun 22, 2007 19:49
Forum: General
Topic: Line Input, Eof() – linefeed weird bug?
Replies: 8
Views: 2876

Your results are the same as mine, missing between about 790 and 810 bytes from the end of files having lengths between 0 and 800 bytes beyond all 8192 byte block boundaries. Hopefully most files are CRLF line terminated so this will not effect them. My work-around would read the LF terminated file ...
by Richard
Jun 22, 2007 13:14
Forum: General
Topic: Line Input, Eof() – linefeed weird bug?
Replies: 8
Views: 2876

Line Input, Eof() – linefeed weird bug?

I was getting syntax errors from the output of my automatic translation system. I tracked it down to missing the tail of the input file. It was falsely detecting “end of file” and did not read in the last few lines. This effect showed on two files out of about one hundred. Those two files had length...
by Richard
Jun 15, 2007 1:28
Forum: General
Topic: Default BYVAL or BYREF Parameter Passing?
Replies: 128
Views: 28762

The terminology is being misused. In both mathematics and in programming, constants are things that do not change their value within a program. Parameters retain a particular value for this instance or run. Variables are expected to change. Arguments are the things functions and subroutines work wit...
by Richard
Jun 14, 2007 23:17
Forum: General
Topic: Default BYVAL or BYREF Parameter Passing?
Replies: 128
Views: 28762

What I really wanted to know was why such a fundamental change had been made. There is no point holding another pole as v1ctor is clearly firm in the decision not to restore an across the board ByRef default. This discussion has polarised to the point where both sides have dug into defensive positio...
by Richard
Jun 12, 2007 22:49
Forum: General
Topic: Default BYVAL or BYREF Parameter Passing?
Replies: 128
Views: 28762

As the weight of evidence presented in this thread leans towards a consistent ByRef default, v1ctors objection must be based on something missing from the discussion. Now it is not too late to argue the case for no change. Does anyone have any ideas as to what the reason is? My guess is that it has ...
by Richard
Jun 10, 2007 8:35
Forum: General
Topic: Default BYVAL or BYREF Parameter Passing?
Replies: 128
Views: 28762

Following on from jevans4949 post of June 8th. C was never designed. C grew out of Macro Assembler on the Digital Equipment PDP-11 series machines in the early 1970s. C was a low level language used to automate the telephone network. It has pointers and passes ByVal because that is how assembler pro...
by Richard
Jun 07, 2007 23:58
Forum: General
Topic: Default BYVAL or BYREF Parameter Passing?
Replies: 128
Views: 28762

Any suggestion that we should eliminate the default and insist on explicit ByRef or ByVal so as to force beginners to learn, seems like a real turnoff for those beginners. Why make it any more difficult than necessary? Speed optimisation of the inner loop is not an activity indulged in by beginners....
by Richard
Jun 02, 2007 8:26
Forum: General
Topic: Default BYVAL or BYREF Parameter Passing?
Replies: 128
Views: 28762

1. ByVal default does not protect all arguments from change as arrays and strings are still exposed. If you want to protect a variable from change you could make a copy or even pass it explicitly ByVal. Best of all, don’t change it. 2. I don’t understand stylin’s point number two. “Passing conventio...
by Richard
Jun 02, 2007 0:56
Forum: General
Topic: Default BYVAL or BYREF Parameter Passing?
Replies: 128
Views: 28762

A good language has a minimum of exceptions to the rules. If possible all parameter passing should default to the same type independent convention. This would have to be ByRef because arrays and strings are often too big and slow to copy. I remember 25 years ago, a C programmer arguing that FORTRAN ...
by Richard
May 29, 2007 9:07
Forum: General
Topic: Testing randomness ...
Replies: 21
Views: 4626

What does RANDOM mean? A lack of recognisable pattern? Ideally the encicode produced by a secure? algorithm should produce code that does not contain any pattern or fingerprint due to the algorithm, the key used or the data enciphered, i.e. it should appear random. Cryptanalysis involves trying diff...

Go to advanced search