View Single Post
Re: Strings In United Bot
Old
  (#5)
Pierre-Marie Baty
Roi de France
 
Pierre-Marie Baty's Avatar
 
Status: Offline
Posts: 5,049
Join Date: Nov 2003
Location: 46°43'60N 0°43'0W 0.187A
Default Re: Strings In United Bot - 24-05-2004

nagger

I don't believe "just replacing all chars with some typedef type" would work ; if you notice, in ANSI C Unicode and classical characters are a completely different topic, which call completely different functions. You just can't use strstr, strlen, strrchr, strcpy and the likes properly on a typedef'ed char type. C99 which is the latest ANSI C defines the WCHAR type, and recommends the use of wstrstr, wstrlen, wstrrchr, wstrcpy etc. which are all suited for Unicode and belong to all standard C libs since 1999.

Anyway, dynamic allocation of string bits is what I was referring to. We must avoid as much new() and malloc()s as possible. We could use the same technique as HL1: have a string table and only reference constant strings by their pointer.

The bot chat engine (whether Eliza or a MegaHal bastard) usually requires a lot of dynamic string allocations so I guess we'll have to handle this issue cleverly.



RACC home - Bots-United: beer, babies & bots (especially the latter)
"Learn to think by yourself, else others will do it for you."
  
Reply With Quote