develooper Front page | perl.perl5.porters | Postings from March 2005

const pointers in C

Thread Next
From:
Andy Lester
Date:
March 9, 2005 09:02
Subject:
const pointers in C
Message ID:
20050309170220.GA1382@petdance.com
Do we intentionally avoid constant pointers and pointers to constant
data in the Perl source?

Seems to me that we could have some added security from the compiler if
we changed some of the internal functions of the form

  int foo( char *target, char *source )

to

  int foo( const char *target, const char * const source )

Might also allow some smarter compilers to optimize more aggressively.
I know that when I was doing C years ago, having the parms checked for
constness saved my ass a couple of times, and let lint be smarter.

Is this a road that we're intentionally avoiding?  Or would patches
along these lines be welcome?

xoa

-- 
Andy Lester => andy@petdance.com => www.petdance.com => AIM:petdance

Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About