This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: g77 character strings are not terminated?


mmcohen@ranx.ucsc.edu wrote:
In every other f77 system I've used if one creates
a string like 'a b c', the result is null terminated.
With g77 this seems not to be the case, so it's impossible
to find the end of a string, unless one explicitly
gives the string as 'a b c\0'. However I've got
a zillion lines of code that expect a null.
Is this really what is intended in g77?
Yes.

Is there a compiler flag to set to get null terminated
strings?
No, unfortunately not.

Or is this a bug to be rectified?
Not in our plan. You are the first person in the almost 8 years that g77 is in existence to complain about this.

Fortran character variables have a length associated with them (use len(str) to get at it). They do not need a trailing 0 to determine their "end". So the compiler doesn't supply it.

Hope this helps,

--
Toon Moene - mailto:toon@moene.indiv.nluug.nl - phoneto: +31 346 214290
Saturnushof 14, 3738 XG Maartensdijk, The Netherlands
Maintainer, GNU Fortran 77: http://gcc.gnu.org/onlinedocs/g77_news.html
GNU Fortran 95: http://gcc-g95.sourceforge.net/ (under construction)


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]