[Info-vax] VMS Cobol - GnuCOBOL

Arne Vajhøj arne at vajhoej.dk
Tue Feb 28 08:41:40 EST 2023


On 2/28/2023 8:15 AM, bill wrote:
> On 2/28/2023 6:39 AM, David Wade wrote:
>> On 27/02/2023 23:35, Arne Vajhøj wrote:
>>> On 2/27/2023 5:42 PM, David Wade wrote:
>>>> I feel the issue with debugging "C" is that in order to effectively 
>>>> use the debugger you tend to need to turn down optimisation, but 
>>>> turning down optimization tends to make the code work as you expect. 
>>>> When you turn it up again, undefined behaviour tends to re-emerge.
>>>
>>> /DEB/NOOP is not required but tend to make it easier to
>>> debug because there is a closer correlation between the
>>> instruction stream and the lines of source code.
>>>
>>> And as you point out then that can in fact by itself
>>> remove symptoms of a bug.
>>>
>>> But isn't that the case for all VMS compilers? I know
>>> I use /DEB/NOOP for both Fortran, Pascal and C when I want
>>> to debug.
>>
>> Of course, BUT I feel other languages have fewer places where 
>> undefined behaviour can occur, and so the problem is not so severe.
>>
> 
> And then you have the case (it's been a long while but at one time
> was very common in my experience) where turning off optimization
> "fixes" the problem.

I think it has been a code smell for several decades now.

But I also remember build scripts written for VAX C 3.x that
specified /NOOPT with a note saying that the program would
not work if compiled with /OPT. Tt was indicated several
times though that the code was right and the compiler was wrong.
Of course it was a bit fuzzy what right code really meant before
ANSI/ISO.

When DEC C 4.x hit the streets then things got better. And that
must be more than 30 years ago by now.

Arne







More information about the Info-vax mailing list