1.05.0

General discussion for topics related to the FreeBASIC project or its community.
speedfixer
Posts: 606
Joined: Nov 28, 2012 1:27
Location: CA, USA moving to WA, USA
Contact:

1.05.0

Post by speedfixer »

Thank you for the new build.
srvaldez
Posts: 3379
Joined: Sep 25, 2005 21:54

Re: 1.05.0

Post by srvaldez »

thank you dkl :)
Roland Chastain
Posts: 1002
Joined: Nov 24, 2011 19:49
Location: France
Contact:

Re: 1.05.0

Post by Roland Chastain »

I can't wait to test it. :)
MrSwiss
Posts: 3910
Joined: Jun 02, 2013 9:27
Location: Switzerland

Re: 1.05.0

Post by MrSwiss »

@dkl,

thanks for the new Release.

To highlight one of the Fixes, in the FBC 1.05 x64 Release, Line Attribute:

Code: Select all

WindowTitle "LineAttr.exe -- FBC 1.05 WIN64"
ScreenRes(800,600,32)

' Line Attributes was brocken in prev. 64 bit Versions of FBC
Line ( 50,  50)-(700, 500), &hFFFF0000, B, &h8888	' attr: Short (16bit)
Line (150, 150)-(750, 550), &hFFFFFF00, B, &hFFFC	' HEX or Bin Definition
Line (100, 100)-(650, 450), &hFF0000FF, B, &hCFFC
Line (225, 225)-(575, 375), &hFF00FF00, B, &hCCCC
Draw String (312, 297), "Press any Key to QUIT!"

Sleep : End 0
In all previous x64 Versions, above was broken (x32 Versions NOT affected!).
D.J.Peters
Posts: 8586
Joined: May 28, 2005 3:28
Contact:

Re: 1.05.0

Post by D.J.Peters »

@dkl something new in scope of image memory allocation ?

in FBImage http://www.freebasic.net/forum/viewtopi ... 14&t=24105
I use malloc and ImageDestroy() works fine on windows 32/64-bit but not on Linux ?!?

Joshy

Code: Select all

FBImage* DLL_EXPORT LoadRGBAFile(const char * filename){
  int w,h,c,dpitch,spitch;

  FBImage* img=NULL;
  if (filename==NULL) {
    result_string_pointer="Image load failed no filename !";
    return NULL;
  }
  unsigned char* p = stbi_load(filename,&w,&h,&c,4);
  if (p==NULL){
    result_string_pointer = stbi_failure_reason();
    return img;
  }
  spitch = w*4;
  dpitch = spitch+15;
  dpitch = dpitch & 0xFFFF0;
  img = malloc(32+h*dpitch);  // <--- !!! height x pitch + 32 bytes header !!!
  img->image_hdr = 7;
  img->image_bpp = 4;
  img->image_w   = w;
  img->image_h   = h;
  img->image_p   = dpitch;
  unsigned char * s = p;
  unsigned char * d = (unsigned char*)img;
  d+=32;
  doimg(d,s,dpitch,spitch,w,h);
  free(p);
  return img;
}
dkl
Site Admin
Posts: 3235
Joined: Jul 28, 2005 14:45
Location: Germany

Re: 1.05.0

Post by dkl »

No, there were no changes since 1.04.0 in that area.

However a long time ago the image allocation was changed to put the buffer pointer at image[-1] (so the image ptr is 16-byte aligned, with the original ptr stored in front).
https://github.com/freebasic/fbc/blob/m ... mage.c#L96
Does your code handle that?
D.J.Peters
Posts: 8586
Joined: May 28, 2005 3:28
Contact:

Re: 1.05.0

Post by D.J.Peters »

dkl you are right I must fix it.

I wonder me that ImageDestroy does not crash on Windows but gives a segfault on Linux.

How ever thank you for the right link.

Joshy
Solbianca
Posts: 34
Joined: Feb 11, 2010 7:14

Re: 1.05.0

Post by Solbianca »

Hi,

This class can not inherit.

Code: Select all

type Foo
	public:
		declare constructor()
		declare destructor()
		...
	private:
		declare operator let(byref as const Foo)
		...
end type
Result: error 201: Illegal member access, Foo.operator.let

The derived class is copying the object of the base class internally. Why?

Thanks,
dkl
Site Admin
Posts: 3235
Joined: Jul 28, 2005 14:45
Location: Germany

Re: 1.05.0

Post by dkl »

It could be in the implicit copy constructor or Let operator. If the derived class does not declare the Let operator, the compiler will generate one automatically, which calls the base's Let operator.

The reason for this is that if the base class has a Let overload, then the derived class must have one too, otherwise assignment would be broken: the base's Let operator wouldn't be called when assigning objects of the derived class.
fxm
Moderator
Posts: 12107
Joined: Apr 22, 2009 12:46
Location: Paris suburbs, FRANCE

Re: 1.05.0

Post by fxm »

So the Let operator of the base type must not be private but protected or public.
Example demonstrating this behavior:

Code: Select all

type Foo
   public:
      declare constructor()
      declare destructor()
   protected:
      declare operator let(byref as const Foo)
   private:
      dim as integer dummy
end type

constructor Foo()
end constructor

operator Foo.let(byref f as const Foo)
  print "Foo.let(byref as const Foo)"
end operator

destructor Foo()
end destructor

type FooChild Extends Foo
end type

Dim As FooChild fc1, fc2
fc1 = fc2
Print
Dim As FooChild fc3 = fc1

Sleep
Solbianca
Posts: 34
Joined: Feb 11, 2010 7:14

Re: 1.05.0

Post by Solbianca »

@dkl
@fxm
The reason for this is that if the base class has a Let overload, then the derived class must have one too, otherwise assignment would be broken: the base's Let operator wouldn't be called when assigning objects of the derived class.
Now I get it!
The compiler generated the error because of the derived class has no the copy assignment operator.
I'm thinking about creating a non-copyable class like the following code in C++, but there is not a meaning. The derived class must explicitly implement a Let operator as private member, mmm...

Code: Select all

class noncopyable {
protected:
    noncopyable() {}
    ~noncopyable() {}
private:
    noncopyable(const noncopyable&);
    const noncopyable& operator=(const noncopyable&);
};
BTW, I think that FB needs to have class qualifiers, such as STATIC, FINAL(or SEALED).
Those implementation is difficult?

Thank you for the answers.
integer
Posts: 408
Joined: Feb 01, 2007 16:54
Location: usa

Re: 1.05.0

Post by integer »

I downloaded the latest daily build 03-27-2016: 1.06.0
Is the keyword "__FB_MIN_VERSION__" about to go extinct?

Command executed:
"C:\FreeBasic\fbc.exe" "C:\fb_01\FBIDETEMP.bas"

Compiler output:
C:\fb_01\FBIDETEMP.bas(639) error 41:
Variable not declared, __FB_MIN_VERSION__ in 'print "fb min version: "; __FB_MIN_VERSION__'

Results:
Compilation failed

System:
FBIde: 0.4.6
fbc: FreeBASIC Compiler - Version 1.06.0 (03-27-2016), built for win32 (32bit)
OS: Windows XP (build 2600, Service Pack 3)

It is not a serious problem; just wondering.
SARG
Posts: 1764
Joined: May 27, 2005 7:15
Location: FRANCE

Re: 1.05.0

Post by SARG »

Hi,

It needs some parameters, see documentation.

print __FB_MIN_VERSION__(0, 18, 2) --> true or false
integer
Posts: 408
Joined: Feb 01, 2007 16:54
Location: usa

Re: 1.05.0

Post by integer »

SARG wrote:Hi,

It needs some parameters, see documentation.

print __FB_MIN_VERSION__(0, 18, 2) --> true or false
THANK YOU.

I did not realize that the parameters were part of the keyword.
If the err msg had been "missing parameters" it would have been clear,
but "variable not declared", confused me.

Thanks for evaporating that fog.
MrSwiss
Posts: 3910
Joined: Jun 02, 2013 9:27
Location: Switzerland

Re: 1.05.0

Post by MrSwiss »

Hi all,

just noticed a "funny" behavior, while using: OverLoad(ed) Function and an Array() As Const 'Type-Name' Parameter.
FBC Error: "no matching overloaded Function"
As soon as "Const" is removed, everything works as expected, is this intentional or a BUG?

The intention with Const was, to "write protect" the Array (inside of Function) ... without OverLoad: no Problem!

Testing Code here, modify the FileInfo Function(s) to test.
Post Reply