I am using gfortran compiler. Also tell me if gfortran uses something other than the Fortran standard while performing automatic typecasting (type conversion).
How does automatic typecasting (type conversion) work in Fortran?
6k Views Asked by Yogesh Yadav At
1
There are 1 best solutions below
Related Questions in FORTRAN
- Looping over defined array elements in Fortran
- Is it safe to list optional fortran function argument in OpenMP shared clause?
- Equivalent to asm volatile in Gfortran?
- gfortran does not find symbol fabsq_ in libquadmath
- Assigning values of an array in a loop
- Data exchange - Python and Fortran
- ieee_arithmetic intrinsic module in gfortran
- How to initialize two distinct blacs contexts?
- Fortran Debugging
- need to get f2py working, but don't know any fortran
- Combine Fortran .for and .f90 include header files
- How to parallelize csh script with nested loop
- VS2013 integration with Intel Fortran Compiler
- Windows 8.1 Pro MinGW Gfortran Command Prompt 'not recognized command' error
- How does automatic typecasting (type conversion) work in Fortran?
Related Questions in FORTRAN90
- Assigning values of an array in a loop
- How does automatic typecasting (type conversion) work in Fortran?
- Fortran DO loop, warning to use integer only
- Array slicing in FORTRAN 77
- Fortran derived type in common: initialization?
- Fortran: makefile error
- Ambiguous reference to variable
- Unclassifiable statement at (1) in Fortran
- unformatted output with wild card in Fortran
- Sum and Construct an Array in one statement
- Subroutine Name Fortran Name
- Fortran calculate distance of many points to fixed point
- What is the purpose of result variables in Fortran?
- What does 0.0_p2 mean?
- How to initialize array of integer kind 8 in fortran?
Related Questions in GFORTRAN
- Equivalent to asm volatile in Gfortran?
- gfortran does not find symbol fabsq_ in libquadmath
- Assigning values of an array in a loop
- ieee_arithmetic intrinsic module in gfortran
- Windows 8.1 Pro MinGW Gfortran Command Prompt 'not recognized command' error
- How does automatic typecasting (type conversion) work in Fortran?
- gfortran doesn't compile real variables
- Undefined reference to `linrg_` in IMSL library with gfortran in CodeBlocks
- Fortran DO loop, warning to use integer only
- Checking all elements of array for a logical condition in fortran
- Why are these two calculations which are exactly same giving different results in Fortran using gfortran?
- Different behaviour of compiler when called in script by LaunchControl
- How do I install gtk-fortran on windows 8?
- selected_real_kind in gfortran and code::blocks
- 32-bit pointer overflow in 64-bit gcc code - fails in compile
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
Assignment is defined by Fortran 2008 Section 7.2. Of note is Cl. 7.2.1.3 paragraph 8:
This means that any expression (
expr) will be implicitly converted to the type and kind of the variable it is being assigned to. For character types, derived types and anything else, please see the standard.Also note that Fortran only performs conversions like this during assignment and initialization but not contexts like procedure calls. For example, consider this procedure:
This procedure has a dummy argument of type integer. You cannot, for example, do this:
because this results in a mismatch of type between the actual and dummy arguments.
You can, however, do this:
because the implicit conversion is defined for the assignment.
The only documented extension to the standard for implicit type conversion in gfortran (5.1.0) is between logical and integer types during assignment.
See: https://gcc.gnu.org/onlinedocs/gcc-5.1.0/gfortran/Implicitly-convert-LOGICAL-and-INTEGER-values.html#Implicitly-convert-LOGICAL-and-INTEGER-values
.true.is converted to integer1.false.is converted to integer00is converted to.false..true.Do note that if you can do without legacy extensions then don't use them. Using them means your program is not standard Fortran and thus any compiler is free to reject it for being incorrect. This extensions is meant to allow legacy code to compile with modern compilers and not for use in new code.