03-08-2004, 10:07 AM
|
Free Member
|
|
Join Date: Mar 2004
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
try these 2 methods: although i dont know how diko is based .
1.
Simply substitute
char buf[100];
with
char buf[BUFSIZE];
all
sprintf(buf, ...
statements with
snprintf(buf, BUFSIZE, ...
where BUFSIZE could be defined as
#define BUFSIZE 256
somewhere in the .cpp file.
sprintf should'nt be used anyway
2.
http://www.opengroup.org/onlinepubs/.../limits.h.html
|
Someday, 12:01 PM
|
|
Site Staff / Ad Manager
|
|
Join Date: Dec 2002
Posts: 42
Thanks: ∞
Thanked 42 Times in 42 Posts
|
|
|
03-08-2004, 10:20 AM
|
Free Member
|
|
Join Date: May 2003
Posts: 10,463
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
I'm not sure the forum is the place to discuss about C language trick.
Please, I'm coding all the day in C at the office and I come on the board to have a break
|
03-08-2004, 02:10 PM
|
Invalid Email / Banned / Spammer
|
|
Join Date: May 2003
Posts: 3,726
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Actually even char* shouldn't be used, there are good and safe string libraires like wxString, std::string and so on. But when I was developing the initial command-line version, I couldn't find another way to create custom command-lines to run auxiliary software. For now, I'll just increase the buffer to 4096 (I have been using 255), I am sure 4 kb of extra memory won't make any difference to anyone. In the future, I'll use a good string library.
|
03-08-2004, 02:38 PM
|
Free Member
|
|
Join Date: Apr 2002
Location: Puerto Rico, USA
Posts: 13,537
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Quote:
Originally Posted by vmesquita
I am sure 4 kb of extra memory won't make any difference to anyone.
|
Oh no
4KB, that's the size of the complete RAM on a ZX81 basic computer, and you're using it just for a file name
|
03-08-2004, 04:00 PM
|
Invalid Email / Banned / Spammer
|
|
Join Date: May 2003
Posts: 3,726
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Quote:
Originally Posted by kwag
Oh no
4KB, that's the size of the complete RAM on a ZX81 basic computer, and you're using it just for a file name
|
Makes me remember my first computer, a 8-bit Z80 based "MSX", that had 64 kb of memory and could be expanded to 128 kb... I created lots of programs using the built in BASIC language in this back when I was a kid, it was so much fun... I still got the MSX but isn't working properly anymore. Other day I saw a guy selling a still working MSX for 20 reais (about US$ 6.5) and I almost bought it!
|
03-08-2004, 04:05 PM
|
Free Member
|
|
Join Date: May 2003
Posts: 10,463
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
MSX ! It was supposed to become the new standard for home computers as all Japan brands sign in the white book : they were all supposed to do computers compatible between them. But soon came the msx2 (with 128 Kb insteed of 64) and almost no MSX computer never communicate an other one .
|
03-08-2004, 06:05 PM
|
Free Member
|
|
Join Date: Apr 2002
Location: Puerto Rico, USA
Posts: 13,537
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Quote:
Originally Posted by vmesquita
I created lots of programs using the built in BASIC language in this back when I was a kid, it was so much fun...
|
I believe you. I had more fun writing programs in my Atari 800, than writing programs on a PC
Tight resources always forced you to make tight and efficient programs.
Now, we just throw away memory, and OSs are very inefficient.
Look at a "Hello World" program written in VB, where the .exe is over 2MB
Talk about bloat
Before, you had a complete "Space Invaders" game written in only 8KB for an arcade machine
What happened I think the industry went to "The Twilight Zone"
-kwag
|
03-08-2004, 07:56 PM
|
Free Member
|
|
Join Date: Jan 2004
Location: Canada
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Doesn't anyone write assembly anymore?
I think the last applications that were pure assembly on PCs were console emulators in the late 90s.
Actually I found a modern RTS game programmed purely in assembly, can't remember the name.
Wow, this thread is off-topic
|
03-08-2004, 07:59 PM
|
Free Member
|
|
Join Date: Apr 2002
Location: Puerto Rico, USA
Posts: 13,537
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Quote:
Originally Posted by jonny_eh
Wow, this thread is off-topic
|
I already moved it to the C/C++ section
-kwag
|
03-08-2004, 08:02 PM
|
Free Member
|
|
Join Date: May 2003
Posts: 10,463
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Quote:
Originally Posted by jonny_eh
Doesn't anyone write assembly anymore?
|
Some people wrote even directly APIC code. For instance peoples that do ripped RPC1 firmware for DVD driver. As they have to do reverse ingeenering on the original firmware, they talk directly the language used by the EEPROM ! Te same for people turning standalones into multizone.
|
03-08-2004, 08:03 PM
|
Free Member
|
|
Join Date: May 2003
Posts: 10,463
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Quote:
Originally Posted by kwag
Quote:
Originally Posted by jonny_eh
Wow, this thread is off-topic
|
I already moved it to the C/C++ section
-kwag
|
Yes, that's what Jonny_eh said : the thread is off-toppic
|
03-08-2004, 08:29 PM
|
Free Member
|
|
Join Date: Apr 2002
Location: Puerto Rico, USA
Posts: 13,537
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Quote:
Originally Posted by Dialhot
Yes, that's what Jonny_eh said : the thread is off-toppic
|
Yes, but it's closer to C/C++ than it is to DIKO (the original thread) :P
-kwag
|
All times are GMT -5. The time now is 02:23 AM — vBulletin © Jelsoft Enterprises Ltd
|