digitalmars.D.bugs - "private public public" in front of class decl
- Sai (47/47) Jul 14 2004 I tried to compile
- Regan Heath (11/58) Jul 14 2004 Do both source files
- Walter (3/4) Jul 22 2004 Yes. Each later one overrides the previous one.
- Vathix (14/18) Jul 22 2004 ?!!
I tried to compile ---------------------------------------------- module sai.math; private public public class Matrix { public: this () { } } ---------------------------------------------- And it got compiled and linked without any error or warning !!! Is it legal to have "private public public" in front of "class Matrix" ?!! Then I added a main method and it failed to link with following error: ---------------------------------------------- module sai.math; private public public class Matrix { public: this () { } } int main() { Matrix m = new Matrix(); return 0; } ---------------------------------------------- Error: ------------------------------------------------- Compiling : 7/14/2004 - 19:34:39 ------------------------------------------------- Command : C:\dmd\bin\dmd.exe -g -gt -debug -c -I. -I.. -odD:\temp\proj\OBJECT~1 "D:\temp\proj\proj.d" "D:\temp\proj\mat.d" Output : ------------------------------------------------- Linking : 7/14/2004 - 19:34:39 ------------------------------------------------- Command : C:\dmd\bin\..\..\dm\bin\link.exe D:\temp\proj\OBJECT~1\proj.obj+D:\temp\proj\OBJECT~1\mat.obj,proj.exe,,/noi/CO; Output : OPTLINK (R) for Win32 Release 7.50B1 Copyright (C) Digital Mars 1989 - 2001 All Rights Reserved D:\temp\proj\OBJECT~1\mat.obj(mat) Offset 00527H Record Type 00C3 Error 1: Previous Definition Different : __Dmain Compiler Return Code : 0 Linker Return Code : 1 Understanding this link error is beyond my capabilities. Shouldn't it fail to compile in the first place ? -Sai
Jul 14 2004
On Wed, 14 Jul 2004 23:40:18 +0000 (UTC), Sai <Sai_member pathlink.com> wrote:I tried to compile ---------------------------------------------- module sai.math; private public public class Matrix { public: this () { } } ---------------------------------------------- And it got compiled and linked without any error or warning !!! Is it legal to have "private public public" in front of "class Matrix" ?!! Then I added a main method and it failed to link with following error: ---------------------------------------------- module sai.math; private public public class Matrix { public: this () { } } int main() { Matrix m = new Matrix(); return 0; } ---------------------------------------------- Error: ------------------------------------------------- Compiling : 7/14/2004 - 19:34:39 ------------------------------------------------- Command : C:\dmd\bin\dmd.exe -g -gt -debug -c -I. -I.. -odD:\temp\proj\OBJECT~1 "D:\temp\proj\proj.d" "D:\temp\proj\mat.d" Output : ------------------------------------------------- Linking : 7/14/2004 - 19:34:39 ------------------------------------------------- Command : C:\dmd\bin\..\..\dm\bin\link.exe D:\temp\proj\OBJECT~1\proj.obj+D:\temp\proj\OBJECT~1\mat.obj,proj.exe,,/noi/CO; Output : OPTLINK (R) for Win32 Release 7.50B1 Copyright (C) Digital Mars 1989 - 2001 All Rights Reserved D:\temp\proj\OBJECT~1\mat.obj(mat) Offset 00527H Record Type 00C3 Error 1: Previous Definition Different : __Dmain Compiler Return Code : 0 Linker Return Code : 1 Understanding this link error is beyond my capabilities.Do both source files "D:\temp\proj\proj.d" "D:\temp\proj\mat.d" contain a main function? If so, remove one of them.Shouldn't it fail to compile in the first place ?Yeah. I think it should be an error to use more than one of private, protected, public here or anywhere else for that matter. Regan. -- Using M2, Opera's revolutionary e-mail client: http://www.opera.com/m2/
Jul 14 2004
"Sai" <Sai_member pathlink.com> wrote in message news:cd4g91$qns$1 digitaldaemon.com...Is it legal to have "private public public" in front of "class Matrix" ?!!Yes. Each later one overrides the previous one.
Jul 22 2004
"Walter" <newshound digitalmars.com> wrote in message news:cdnv68$hh4$1 digitaldaemon.com..."Sai" <Sai_member pathlink.com> wrote in message news:cd4g91$qns$1 digitaldaemon.com...?!!Is it legal to have "private public public" in front of "class Matrix"Yes. Each later one overrides the previous one.I had something like this: class Matrix { protected: // stuff... public final: void neo(); // other public and final stuff... } Neo was still protected while in the Matrix. LOL really, I had to use public: final: .
Jul 22 2004