Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ Library support » U++ Libraries and TheIDE: i18n, Unicode and Internationalization » Improvements to several Lang.cpp functions
icon3.gif  Improvements to several Lang.cpp functions [message #19941] Tue, 03 February 2009 23:21 Go to next message
Novo is currently offline  Novo
Messages: 890
Registered: December 2006
Experienced Contributor
It is possible to use _alloca() instead of fixed size stack buffer on Windows.

Regards,
Novo
Re: Improvements to several Lang.cpp functions [message #20046 is a reply to message #19941] Fri, 13 February 2009 11:07 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 12105
Registered: November 2005
Ultimate Member
Novo wrote on Tue, 03 February 2009 17:21

It is possible to use _alloca() instead of fixed size stack buffer on Windows.


I believe it is not worth of trouble. These functions do not tend to be called in recursion and buffer sizes are adequate.

Mirek
Re: Improvements to several Lang.cpp functions [message #20053 is a reply to message #20046] Sat, 14 February 2009 01:47 Go to previous messageGo to next message
Novo is currently offline  Novo
Messages: 890
Registered: December 2006
Experienced Contributor
luzr wrote on Fri, 13 February 2009 05:07

Novo wrote on Tue, 03 February 2009 17:21

It is possible to use _alloca() instead of fixed size stack buffer on Windows.


I believe it is not worth of trouble. These functions do not tend to be called in recursion and buffer sizes are adequate.

Mirek


Smile It is just cleaner code and more efficient memory usage. You do not need such big buffer in most cases.


Regards,
Novo
Re: Improvements to several Lang.cpp functions [message #20386 is a reply to message #20053] Mon, 16 March 2009 10:25 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 12105
Registered: November 2005
Ultimate Member
Novo wrote on Fri, 13 February 2009 19:47

luzr wrote on Fri, 13 February 2009 05:07

Novo wrote on Tue, 03 February 2009 17:21

It is possible to use _alloca() instead of fixed size stack buffer on Windows.


I believe it is not worth of trouble. These functions do not tend to be called in recursion and buffer sizes are adequate.

Mirek


Smile It is just cleaner code and more efficient memory usage. You do not need such big buffer in most cases.



I do not believe that alloca is better code... It is longer code and it is (in general, it is perhaps not a problem here) platform/compiler specific (AFAIK).

Mirek
Re: Improvements to several Lang.cpp functions [message #20399 is a reply to message #20386] Tue, 17 March 2009 03:37 Go to previous message
Novo is currently offline  Novo
Messages: 890
Registered: December 2006
Experienced Contributor
I don't insist on using alloca(). Smile
I'm pretty sure alloca() doesn't exist on gaming consoles, but it exists in msvc, glibc (Linux and BSD).

Below is an implementation of alloca(), which I found in GLIBC.

# define alloca(size)	__builtin_alloca (size)

#ifndef NO_UNDERSCORES
#define __builtin_alloca ___builtin_alloca
#endif

ENTRY (__builtin_alloca)
	sub %sp, %o0, %sp	/* Push some stack space.  */
	retl			/* Return; the returned buffer leaves 96 */
	add %sp, 96, %o0	/* bytes of register save area at the top. */
END (__builtin_alloca) 


IMHO, using of alloca() is just safer and cleaner. But that is completely up to you.


Regards,
Novo

[Updated on: Tue, 17 March 2009 03:38]

Report message to a moderator

Previous Topic: Basic character set analyzer
Next Topic: Russian tr file for SVN 963
Goto Forum:
  


Current Time: Thu Nov 21 15:04:10 CET 2019

Total time taken to generate the page: 0.01135 seconds