forums.silverfrost.com Forum Index forums.silverfrost.com
Welcome to the Silverfrost forums
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

UNDEF and 64bits

 
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> 64-bit
View previous topic :: View next topic  
Author Message
DanRRight



Joined: 10 Mar 2008
Posts: 1879
Location: South Pole, Antarctica

PostPosted: Wed Apr 25, 2018 7:20 pm    Post subject: UNDEF and 64bits Reply with quote

Let's not discuss here the style of programmers and the error-prone situations associated with it, let's discuss how compiler finds the errors.

1) Suppose programmer made a typo and code does not works right. This simple code has undefined variables kPlot1, kPlot2, kPlot3 in the function CB_PLOT but compiled with /UNDEF the 64bit debugger does not find them. The 32bit debugger immediately stops on error.

2) But both 32 and 64bit compiled with /UNDEF programs miss the same undefined variables in the function PLOT: Clearwin+ swallows them without a hiccup. Clearwin+ design has to be changed in this respect and always check for undefined input variables. What's bad if some buttons initially do not work due to that? They will work after you click on them you may say. If Clearwin does not check for such variables we always have buggy unstable GUI which will make us nuts often influencing other places. I was searching for some crazy errors in Clearwin's %pl last week day and night, for example, and still searching. And also had two crazy errors i could not find for a decade one is crashing %PS every time i use it. One such old bug crashing GUI was found recently and it was due to undefined variable in %ls.

Code:
module All_subs_Bremms
  use clrwin
  integer, parameter :: idim=100
  real*8 x(idim), y1(idim), y2(idim), y3(idim)

  character*320 chParForSimplePlot_f_E
  integer kPlot1, kPlot2, kPlot3
  integer k32bit, k64bit, kSave_f_E_to_File
  integer lxGr, lyGr, iRunning_El_f_E_Fit
  real*8  TextSizeSmplpl_r8, LineWidthSmplpl_r8
  integer iRunning_El_f_E_Fit
  real*8 MaxEnergyFor_f_E
  real*8 aStepIncrE0
contains
end module


Program Caller
use All_subs_Bremms
integer, external:: Plot, cb_Plot

     lxGr = 800
     lyGr = 600
     TextSizeSmplpl_r8  = 2.2
     LineWidthSmplpl_r8 = 3

     iRunning_El_f_E_Fit = 0   
     aStepIncrTe = 1.e-3
     aStepIncrTi = 1.e-3
     aStepIncrE0 = 1.e-3
     MaxEnergyFor_f_E = 1e7

     chParForSimplePlot_f_E = '%pv%pl[x_axis="E [keV]",y_axis="f(E) (arb.un.)",title="Electron f(E) - blue,  Ion f(E) - black",&
     &colour=blue, colour=black, colour=red, x_array, scale=log_linear, N_GRAPHS=3, Y_MIN=1.] %ff&'

     x (:)   = 0
     y1(:)   = 0
     y2(:)   = 0
     y3(:)   = 0

     k_Plot1 = 0
     k_Plot2 = 0
     k_Plot3 = 0

     k32bit  = 0
     k64bit  = 1 

    jj = cb_plot()

i=winio@('%ww&')
i=winio@('In 32bits - Old and New, in 64 only New PL%nl %ff%rb[OldPL]%rb[NewPl]%ff&', k32bit, k64bit)
i=winio@('%2`ga %nl %ff%cn%^bt[Start]%es', k32bit, k64bit, Plot)

end program

!......................................

  integer function cb_plot ()
     use All_subs_Bremms

   IF(iRunning_El_f_E_Fit.eq.1) goto 10000
      iRunning_El_f_E_Fit = 1

   do i=1,  idim
     X (i) = i
     Y1(i) = 1000.*(sin(i/7.))**2 * kPlot1
     Y2(i) = 200. *(sin(i/7.))**2 * kPlot2
     Y3(i) = 300. *(sin(i/7.))**2 * kPlot3
   enddo

     Y1(:) = max(1.e-30,Y1(:))
     Y2(:) = max(1.e-30,Y2(:))
     Y3(:) = max(1.e-30,Y3(:))


     iRunning_El_f_E_Fit = 0

10000  cb_plot = 2
  end function cb_plot
!---------------------------
 integer function Plot ()

   use All_subs_Bremms
   integer, external ::  cb_Plot

         i=winio@('%ww&')
         i=winio@('%^rb[Plot Ion1]%ff&', kPlot1, cb_plot)
         i=winio@('%^rb[Plot Ion2]%ff&', kPlot2, cb_plot)
         i=winio@('%^rb[Plot Ion3]%es', kPlot3, cb_plot)

Plot = 2
end function


Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> 64-bit All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group