Naming "Feature" with Harbour Compiler?

Naming "Feature" with Harbour Compiler?

Postby xProgrammer » Sun Nov 23, 2008 5:55 am

Hi all

It seems that if I use the same name for the source file of a class as the class itself ( for example CLASS myclass in file myclass.prg ) the harbour compiler gives an error, namely:

Error F0002 Redefinition of procedure or function: 'MYCLASS'
1 error

and the compilation ( to C source ) fails.

Is this correct / normal behaviour? Certainly xHarbour doesn't have any such problem.

Is this why so many classes are prefaced with a "T" ?

Thanks
xProgrammer
User avatar
xProgrammer
 
Posts: 464
Joined: Tue May 16, 2006 7:47 am
Location: Australia

Postby Antonio Linares » Sun Nov 23, 2008 9:19 am

Doug,

This code is working fine here. Remember to use the flag /n :

myclass.prg
Code: Select all  Expand view  RUN
#include "FiveWin.ch"

function Main()

   local o := MyClass():New()

   MsgInfo( o:ClassName() )

return nil

CLASS MyClass

   METHOD New() INLINE Self

ENDCLASS

> Is this why so many classes are prefaced with a "T" ?

Thats a tradition started from Borland code. They used "T" to distinct between a function name and a Class name. "T" was used for "Type".
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42118
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain


Return to FiveLinux / FiveDroid (Android)

Who is online

Users browsing this forum: No registered users and 1 guest