View unanswered posts | View active topics It is currently Fri Mar 29, 2024 8:38 am



Reply to topic  [ 19 posts ]  Go to page Previous  1, 2
 Black Widow Core 
Author Message

Joined: Mon Oct 07, 2019 2:41 am
Posts: 585
Check the typing,
The last fault I found was in a bios library I was revising. A typo in revised branch label,sent me to a random place
in the code. Having had changes just made to the string and printf functions made locating the bug harder.
I am moving away from C strings to a Pascal style string with the first byte indicating length. 0 length is a string
constant that is null terminated. This way I can later impliment a string data type, in the langauge I am developing.
string animal[12]
animal = get a animal name()
if overflow do string error()
if animal = 'duck' print "quack!" -- duck
or animal = 'cow' print "moo!" -- cow
else print "streak! beer! barmaid!" -- default human
fin
I have been finding C strings are too quick and dirty for production work having no length,
Ben.


Sun May 01, 2022 9:13 pm
Profile

Joined: Sun Oct 14, 2018 5:05 pm
Posts: 59
oldben wrote:
Check the typing,
The last fault I found was in a bios library I was revising. A typo in revised branch label,sent me to a random place
in the code. Having had changes just made to the string and printf functions made locating the bug harder.
I am moving away from C strings to a Pascal style string with the first byte indicating length.


*cough*

I think you mean BCPL style strings here ;-)

Quote:
0 length is a string
constant that is null terminated. This way I can later impliment a string data type, in the langauge I am developing.


Neither way is perfect and both ways have issues. The BCPL way is limiting although it's not always obvious - writing an editor that supports an arbitrary line length for example...

-Gordon


Mon May 02, 2022 5:20 pm
Profile

Joined: Mon Oct 07, 2019 2:41 am
Posts: 585
drogon wrote:
Neither way is perfect and both ways have issues. The BCPL way is limiting although it's not always obvious - writing an editor that supports an arbitrary line length for example...
-Gordon

I guess with the wider screens one can have 80x132 text windows.

I did it this to way have easy upgrade path, so I can hand port programs
in C like my cross assembler to the language I am using for this machine.

The correct way is type string { int size; int length, buffer[];}
The same could be said for any array type.
We have yet to fix bugs with C strings and we keep getting more and more
versions of text encoding.

Ben.


Tue May 03, 2022 2:36 am
Profile

Joined: Sat Feb 02, 2013 9:40 am
Posts: 2095
Location: Canada
Just looked at this core briefly after leaving it for a while.

For some reason I added SETxx instructions to the ISA when there were already CMPxx instructions doing the same thing. It must have been when I was working away at two different times.

_________________
Robert Finch http://www.finitron.ca


Sat Jul 16, 2022 3:20 am
Profile WWW
Display posts from previous:  Sort by  
Reply to topic   [ 19 posts ]  Go to page Previous  1, 2

Who is online

Users browsing this forum: No registered users and 10 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group
Designed by ST Software