Topic: Character maximal length
Hi,
Is there a maximal length for character variable? (Like 256 in some F77 compiler). Or I can use a length of 500 or greater if I need to?
Thanks
For discussions of all Approximatrix products and related software
You are not logged in. Please login or register.
Approximatrix Forums → User Support → Character maximal length
Hi,
Is there a maximal length for character variable? (Like 256 in some F77 compiler). Or I can use a length of 500 or greater if I need to?
Thanks
The max length for a character depends on the compiler you're using. Simply Fortran, by default, uses gfortran, but I can't find the maximum length for them. However, I found that the NAG compiler has a limit of 2,147,483,647. Regardless of how close that is to gfortran's limit, I think you're fine with 500 or more.
John is correct, I believe. The compiler should only allow strings with a length of approximately 2 billion characters. This limit is also the maximum integer representable on the platform. Your string, however, in this case would consume 2GB of memory (plus Fortran overhead), which wouldn't be possible on 32-bit Windows anyway.
Incidentally, if you define your string length in source to be too large, the compiler should issue an error, so you won't run into runtime issues with strings being too long.
Approximatrix Forums → User Support → Character maximal length
Powered by PunBB, supported by Informer Technologies, Inc.