I've been struggling with an issue for about a week now with a program that I used to compile using CVF for the 32-bit Release Version and IVF 11.1.070 for 64-Bit Debug and Release versions.
At the end of last week my Visual Studio 6 died on my 64-bit XP Machine. I've tried reinstalling it but it still crashes everytime I try to open a file. The project can be selectedbutVS6 also crashes when loading project files.
CVF had been working quite happily on the same computer for over a year. The reasons Icontinued touse it were mainly because I prefer the resource editor in VS6 to that in VS2008 and the 32-bit application is the one used by my customers for over ten years.
For customers with 64-bit machines I have successfully used IVFand both variants of the program show consistency in their function and output etc.
My first thought was to simply finally drop CVF and switch to IVF for all versions (something I meant to do anyway so that new features can be adopted in the future releases) but unfortunately the IVF 32bit Release compiled version of my program crashes.
32bit debug, 64bit release & debug versions all seem to work fine. I uselots of allocatable user defined types that have allocatable components and it is during deallocaton of one of these that the program crashes. I identifid the cause by adding write statements at various places within the code.
During my debugging sessions (on release configuration) I came across a few dodgy programming quirks that I would like to discuss.
For all dtat types I write a module that manages all instances within the program. The module contains routines to allocate, copy instances (using operator module procedure), increase/decrease size (not using reallocate) and deallocate.
1) Is using the UBOUND function on an unallocated array or data structure a safe thing to do? It returns 0 which suggests it works but maybe inconsistent on other computers.
2) What does allocating something ALLOCATE (x(0)) actually mean? This caused problems on CVF as the ALLOCATED(x) result would have been .false. but DEALLOCATE(x) would crash the program. I have no suchdeclarations in my code that I am aware of. ShouldIVF allow this.
3) In order to initialise a data structure I have a single instance of the structure with all components initialised as required. In the case of allocatable components I allocate to a minimum size. I then use a single statement to initialise the whole array. eg
integer :: b
type(DATAT),allocatable :: x(:)
type(DATAT) :: x0
x0%a = 0.0
x0%b = 0
allocate(x(100)) ! Line XX
x = x0
However if for some reason you don't firstly allocate x, eg by removing Line XX the program still allows the
x = x0. Is this correct?
4) optional arguments.Should the following statement be allowed? If not could either compiler or run time error be issued?
integer,intent(in) :: a
integer,intent(in),optional :: b
! Do something
! Do something else
Although I've not got a solution to my problem yetI thought I'd bring these to everyone's attention for comment.
Any further advice would be much appreciated.