General Discussion Undecided where to post - do it here. |
Reply to Thread New Thread |
|
![]() |
#2 |
|
|
![]() |
![]() |
#4 |
|
|
![]() |
![]() |
#5 |
|
|
![]() |
![]() |
#7 |
|
|
![]() |
![]() |
#8 |
|
|
![]() |
![]() |
#9 |
|
|
![]() |
![]() |
#11 |
|
I pinged another IBMer I knew. Turns out this program runs fine in IBM's compiler on AIX and Linux. Looks like a compiler bug in g77.
As for your issue, I can't recreate it with our compilers. I got another IBMer buddy of mine to look into it and he also couldn't see any problems. It seems the only difference is that IRCON receives integer literal in the second case. Sorry I couldn't be of more help here. |
![]() |
![]() |
#13 |
|
|
![]() |
![]() |
#15 |
|
It still causes segfault if you properly assign return value.
The reason my code does not properly assign return value is that this is just a simple example. I deleted all the parts which were not relevant. I didn't think you would want to read through 50 lines of common block declarations and 1000 lines of some fairly abtruse physics thinking in order to see the problem. That's also the reason the code doesn't do anything useful in its current form. |
![]() |
![]() |
#16 |
|
|
![]() |
![]() |
#18 |
|
Originally posted by KrazyHorse
Nor do I particularly want to know. All I know is that FORTRAN sucks. SUUUUUUUCCCCCCKKKKKKS ![]() Third post in a row... and they actually count, too. ![]() Good night! ![]() |
![]() |
![]() |
#20 |
|
The corresponding C code would not be less efficient, given similar compiler settings (optimization). The most remarkable difference would be, that in C (at least with the default "cdecl" calling convention) the direct value 7 is passed on the stack, while in this Fortran version a pointer to a memory location containing 7 is passed there. In terms of performance that makes no difference, both (direct value and address) are numbers, and of the same width too.
Plain C is certainly not perfect, but for a good and careful programmer it is a mighty tool, as he has control over practically everything. C++, if properly used, produces safer and better readable code at the cost of a bit performance (the overhead is slightly greater). Yet more "comfortable" languages like C#, Java et al. (I call them languages for the lazy) give up a yet greater deal of performance and control in exchange for yet more safety and comfort. In the end it matters what your program is supposed to do. If you write a GUI (lots of graphics, little or no performance issues), the usage of C would be quite painful. C++ and a good class library would be better, but best would be C# or Java. If you write compact and fast code without a big interface (like firmware or embedded applications), C++ should be the best tool, perhaps even plain C. If you do OS core programming, you usually deal with a stripped down version (no full featured library) of C. |
![]() |
Reply to Thread New Thread |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
|