Feed aggregator

Bugs on syntax for declaring and for defining module constructor or module destructor

fbc bugs - Fri, 04/18/2014 - 03:33

1) No coherence test checked between declaration and definition for module constructor/destructor
First bug:
- For procedures (Sub) with Constructor/Destructor (Module) in their procedure body definitions, Constructor/Destructor (Module) can also be specified in the corresponding declarations, in principle for improved code readability.
- But in that precise case (module constructor/destructor) there is no coherence test between definition and declaration. At declaration level, Constructor/Destructor (Module) is authorized but fully ignored except for verifying that member procedure is well declared as static (at worst, we can declare as a module destructor a procedure defined as a module constructor without compiler error).

Remark:
- For member procedures with Static/Virtual in their declaration, Static/Virtual can also be specified on the corresponding procedure body definitions, for improved code readability, but a coherence test is well executed at the compilation time.

No compiler error (same behavior for a non-member procedure when there is incoherence between declaration and definition)!

Type UDT Dim As Integer dummy Declare Static Sub init () Constructor '' incoherence between declaration / definition End Type Static Sub UDT.init () '' incoherence between declaration / definition Print "Init successfull" End Sub Print "End" Sleep

Output:
End

2) Non-static member procedure allowed to be defined as module constructor/destructor
Second bug:
- We can define a non-static member procedure as module Constructor/Destructor (if Constructor/Destructor is not specified also at the declaration level). The program compiles but crashes at run-time.

No compiler error and program crashes!

Type UDT Dim As Integer dummy Declare Sub init () '' non-static member procedure End Type Sub UDT.init () Constructor '' non-static member procedure Print "Init successfull" End Sub Print "End" Sleep

Output:
Init successfull
Appuyez sur une touche pour continuer...

3) Private static member procedure allowed to be defined as module constructor/destructor
Rather a final remark:
- A private static member procedure can be defined as module constructor or module destructor.
- This may be subject to discussion, because that possibility can be considered as an initialization similarly to the initialization statement from outside the Type used for a static member variable!

No compiler error and program works.

Type UDT Private: Dim As Integer dummy Declare Static Sub init () Constructor '' private static member procedure End Type Static Sub UDT.init () Constructor '' Private static member procedure Print "Init successfull" End Sub Print "End" Sleep

Output:
Init successfull
End

Referring to forum at http://www.freebasic.net/forum/viewtopic.php?p=196786#p196786

Fix naming of array descriptors for arrays with type suffixes

fbc commits - Thu, 04/17/2014 - 18:31

Fix naming of array descriptors for arrays with type suffixes
View Changes

C/LLVM backends: Use proper array descriptor type for array parameters

fbc commits - Thu, 04/17/2014 - 16:57

C/LLVM backends: Use proper array descriptor type for array parameters
View Changes

Remove compile-time checks for array() parameters again

fbc commits - Thu, 04/17/2014 - 16:57

Remove compile-time checks for array() parameters again
View Changes

parser-decl-var: Remove unused parameter from hCheckExternVar()

fbc commits - Thu, 04/17/2014 - 16:57

parser-decl-var: Remove unused parameter from hCheckExternVar()
View Changes

tests: Fix some constant evaluation tests for 64bit

fbc commits - Thu, 04/17/2014 - 15:39

tests: Fix some constant evaluation tests for 64bit
View Changes

tests: Fix broken 64bit array subscript test

fbc commits - Thu, 04/17/2014 - 15:39

tests: Fix broken 64bit array subscript test
View Changes

Add culng() around point() (when querying colors) and rgb() and rgba()

fbc commits - Thu, 04/17/2014 - 14:50

Add culng() around point() (when querying colors) and rgb() and rgba()
View Changes

tests: Fix the new pointer overload tests for 64bit

fbc commits - Thu, 04/17/2014 - 13:13

tests: Fix the new pointer overload tests for 64bit
View Changes

gfxlib2: Fix 64bit gcc warning

fbc commits - Thu, 04/17/2014 - 12:21

gfxlib2: Fix 64bit gcc warning
View Changes

Overload resolution: Allow passing Long Ptr to Integer Ptr on 32bit, etc.

fbc commits - Thu, 04/17/2014 - 11:54

Overload resolution: Allow passing Long Ptr to Integer Ptr on 32bit, etc.
View Changes

Add missing dir() overloads for LongInt Ptr

fbc commits - Thu, 04/17/2014 - 11:54

Add missing dir() overloads for LongInt Ptr
View Changes

tests: Add some for self-assignments of UDTs with dynamic array fields

fbc commits - Tue, 04/15/2014 - 14:19

tests: Add some for self-assignments of UDTs with dynamic array fields
View Changes

rtlib: Fix fb_ArrayRedimTo() to handle self-assignments

fbc commits - Tue, 04/15/2014 - 12:56

rtlib: Fix fb_ArrayRedimTo() to handle self-assignments
View Changes

#582 -exx pointer checks break bitfield selfops

fbc bugs - Sun, 04/13/2014 - 23:22
  • status: open --> closed
  • assigned_to: dkl
  • Component: --> compiler

ast: Add new dumping function with more compact output

fbc commits - Sun, 04/13/2014 - 23:21

ast: Add new dumping function with more compact output
View Changes

ast: Fix bitfield sidefx removal for self-BOPs and SWAP (fixes #582)

fbc commits - Sun, 04/13/2014 - 23:21

ast: Fix bitfield sidefx removal for self-BOPs and SWAP (fixes #582)
View Changes

#648 REDIM statement causes EXTERN to be allocated

fbc bugs - Sun, 04/13/2014 - 10:01
  • status: open --> closed
  • assigned_to: dkl

tests: Add some pointer CONSTness tests for BYVAL/BYREF parameters

fbc commits - Sun, 04/13/2014 - 10:00

tests: Add some pointer CONSTness tests for BYVAL/BYREF parameters
View Changes

#643 No compiler error if a method tries to resize a member array

fbc bugs - Sun, 04/13/2014 - 09:52
  • status: open --> closed
  • assigned_to: dkl

Pages

Subscribe to FreeBASIC Programming Language aggregator