digitalmars.D - bug: dmd doesn't warn about function not returning a value
- bobef (78/78) Mar 08 2005 I wrote one case once and Walter said this is not a bug
- ss (6/103) Mar 08 2005 Nononononono; errors like that for newbies. That's why you get no
- bobef (10/113) Mar 09 2005 I believe I'm not newbie. And I've not reached Zen neither... but people...
- Unknown W. Brackets (5/14) Mar 11 2005 Please see the changelog for the latest release (DMD 0.116), which now
I wrote one case once and Walter said this is not a bug now I believe this is or if it is not bug I believe compiler should warn about this one especialy for people like me who don't like try,catch stuff... I do not get warning about SearchDiaog.onOK here is the code: module dddd.ide.dialog; import dddd.ide.windows; import std.stdio; ddddDialog[ulong] _g_ddddDialog_map; extern(Windows) int _g_ddddDialogProc(HWND hwndDlg,uint msg,WPARAM w,LPARAM l) { ddddWnd obj=_g_ddddWnd_map[hwndDlg]; if(msg==WM_INITDIALOG) { obj=_g_ddddWnd_map[hwndDlg]=_g_ddddDialog_map[l]; if(obj) obj.m_handle=hwndDlg; } int ret=0; if(obj && obj.m_handle==hwndDlg && (ret=obj.WindowProc(msg,w,l))!=0) return ret; return DefWindowProcA(hwndDlg,msg,w,l); } class ddddDialog : ddddWnd { int WindowProc(uint msg,WPARAM w,LPARAM l) { if(msg==WM_INITDIALOG) return onInitDialog(); return ddddWnd.WindowProc(msg,w,l); } int onInitDialog(){return 0;} ddddWnd getItem(int id) { ddddWnd ret=new ddddWnd; ret.m_handle=GetDlgItem(m_handle,id); if(ret.m_handle) return ret; else return null; } int onCommand(int id,int code) { if(code==BN_CLICKED) { if(id==IDOK) return onOK(); else if(id==IDCANCEL) onCancel(); } return 0; } int onCancel(){return endDialog(IDCANCEL);} int onOK(){return endDialog(IDOK);} int endDialog(int ret){return EndDialog(m_handle,ret);} int Create(ddddWnd parent,int res) { _g_ddddDialog_map[getID()]=this; return DialogBoxParam(theApp.m_instance,MAKEINTRESOURCE(res),parent.m_handle,&_g_ddddDialogProc,getID()); } } class SearchDialog : ddddDialog { const int IDD_DIALOGSEARCH=1000; const int IDC_REPLACEALL =1000; const int IDC_REPLACESEL =1001; const int IDC_MARKALL =1002; const int IDC_SOURCE =1003; const int IDC_REGMENU1 =1004; const int IDC_DEST =1005; const int IDC_REGMENU2 =1006; const int IDC_FILE =1007; const int IDC_ALLFILES =1008; const int IDC_SELECTION =1009; const int IDC_FMATCHCASE =1010; const int IDC_FMATCHWHOLE =1011; const int IDC_FREGULAR =1012; const int IDC_FWRAP =1013; int onOK() { sbtrack(getItem(IDC_SOURCE).getText()); } int Create(ddddWnd parent){return ddddDialog.Create(parent,IDD_DIALOGSEARCH);} }
Mar 08 2005
Nononononono; errors like that for newbies. That's why you get no warning; the run-time errors are like wind-chimes of death; the compiler knows your faults, but if it were to tell you, you would never be able to reach Zen--it must be reached through agonizing trials and tribulations to truly be appreciated! bobef wrote:I wrote one case once and Walter said this is not a bug now I believe this is or if it is not bug I believe compiler should warn about this one especialy for people like me who don't like try,catch stuff... I do not get warning about SearchDiaog.onOK here is the code: module dddd.ide.dialog; import dddd.ide.windows; import std.stdio; ddddDialog[ulong] _g_ddddDialog_map; extern(Windows) int _g_ddddDialogProc(HWND hwndDlg,uint msg,WPARAM w,LPARAM l) { ddddWnd obj=_g_ddddWnd_map[hwndDlg]; if(msg==WM_INITDIALOG) { obj=_g_ddddWnd_map[hwndDlg]=_g_ddddDialog_map[l]; if(obj) obj.m_handle=hwndDlg; } int ret=0; if(obj && obj.m_handle==hwndDlg && (ret=obj.WindowProc(msg,w,l))!=0) return ret; return DefWindowProcA(hwndDlg,msg,w,l); } class ddddDialog : ddddWnd { int WindowProc(uint msg,WPARAM w,LPARAM l) { if(msg==WM_INITDIALOG) return onInitDialog(); return ddddWnd.WindowProc(msg,w,l); } int onInitDialog(){return 0;} ddddWnd getItem(int id) { ddddWnd ret=new ddddWnd; ret.m_handle=GetDlgItem(m_handle,id); if(ret.m_handle) return ret; else return null; } int onCommand(int id,int code) { if(code==BN_CLICKED) { if(id==IDOK) return onOK(); else if(id==IDCANCEL) onCancel(); } return 0; } int onCancel(){return endDialog(IDCANCEL);} int onOK(){return endDialog(IDOK);} int endDialog(int ret){return EndDialog(m_handle,ret);} int Create(ddddWnd parent,int res) { _g_ddddDialog_map[getID()]=this; return DialogBoxParam(theApp.m_instance,MAKEINTRESOURCE(res),parent.m_handle,&_g_ddddDialogProc,getID()); } } class SearchDialog : ddddDialog { const int IDD_DIALOGSEARCH=1000; const int IDC_REPLACEALL =1000; const int IDC_REPLACESEL =1001; const int IDC_MARKALL =1002; const int IDC_SOURCE =1003; const int IDC_REGMENU1 =1004; const int IDC_DEST =1005; const int IDC_REGMENU2 =1006; const int IDC_FILE =1007; const int IDC_ALLFILES =1008; const int IDC_SELECTION =1009; const int IDC_FMATCHCASE =1010; const int IDC_FMATCHWHOLE =1011; const int IDC_FREGULAR =1012; const int IDC_FWRAP =1013; int onOK() { sbtrack(getItem(IDC_SOURCE).getText()); } int Create(ddddWnd parent){return ddddDialog.Create(parent,IDD_DIALOGSEARCH);} }
Mar 08 2005
I believe I'm not newbie. And I've not reached Zen neither... but people make mistakes and it is stupid to waste so much time for stupid errors like that... I noticed this one immediately but it's like... I can not give appropriate example... I think to reach Zen you should write binary code || at least asm :) You have to see the matrix you know... D is just too high level to reach Zen with it... And I don't want crap like VB/Delphi etc where programming is drag-drop. Just a single warning... It is not so much :)) In article <d0l4m4$brc$1 digitaldaemon.com>, ss says...Nononononono; errors like that for newbies. That's why you get no warning; the run-time errors are like wind-chimes of death; the compiler knows your faults, but if it were to tell you, you would never be able to reach Zen--it must be reached through agonizing trials and tribulations to truly be appreciated! bobef wrote:I wrote one case once and Walter said this is not a bug now I believe this is or if it is not bug I believe compiler should warn about this one especialy for people like me who don't like try,catch stuff... I do not get warning about SearchDiaog.onOK here is the code: module dddd.ide.dialog; import dddd.ide.windows; import std.stdio; ddddDialog[ulong] _g_ddddDialog_map; extern(Windows) int _g_ddddDialogProc(HWND hwndDlg,uint msg,WPARAM w,LPARAM l) { ddddWnd obj=_g_ddddWnd_map[hwndDlg]; if(msg==WM_INITDIALOG) { obj=_g_ddddWnd_map[hwndDlg]=_g_ddddDialog_map[l]; if(obj) obj.m_handle=hwndDlg; } int ret=0; if(obj && obj.m_handle==hwndDlg && (ret=obj.WindowProc(msg,w,l))!=0) return ret; return DefWindowProcA(hwndDlg,msg,w,l); } class ddddDialog : ddddWnd { int WindowProc(uint msg,WPARAM w,LPARAM l) { if(msg==WM_INITDIALOG) return onInitDialog(); return ddddWnd.WindowProc(msg,w,l); } int onInitDialog(){return 0;} ddddWnd getItem(int id) { ddddWnd ret=new ddddWnd; ret.m_handle=GetDlgItem(m_handle,id); if(ret.m_handle) return ret; else return null; } int onCommand(int id,int code) { if(code==BN_CLICKED) { if(id==IDOK) return onOK(); else if(id==IDCANCEL) onCancel(); } return 0; } int onCancel(){return endDialog(IDCANCEL);} int onOK(){return endDialog(IDOK);} int endDialog(int ret){return EndDialog(m_handle,ret);} int Create(ddddWnd parent,int res) { _g_ddddDialog_map[getID()]=this; return DialogBoxParam(theApp.m_instance,MAKEINTRESOURCE(res),parent.m_handle,&_g_ddddDialogProc,getID()); } } class SearchDialog : ddddDialog { const int IDD_DIALOGSEARCH=1000; const int IDC_REPLACEALL =1000; const int IDC_REPLACESEL =1001; const int IDC_MARKALL =1002; const int IDC_SOURCE =1003; const int IDC_REGMENU1 =1004; const int IDC_DEST =1005; const int IDC_REGMENU2 =1006; const int IDC_FILE =1007; const int IDC_ALLFILES =1008; const int IDC_SELECTION =1009; const int IDC_FMATCHCASE =1010; const int IDC_FMATCHWHOLE =1011; const int IDC_FREGULAR =1012; const int IDC_FWRAP =1013; int onOK() { sbtrack(getItem(IDC_SOURCE).getText()); } int Create(ddddWnd parent){return ddddDialog.Create(parent,IDD_DIALOGSEARCH);} }
Mar 09 2005
Please see the changelog for the latest release (DMD 0.116), which now includes warnings such as the one you're asking for (on a trial basis, I believe.) Please note that they're not completely working yet. -[Unknown]I believe I'm not newbie. And I've not reached Zen neither... but people make mistakes and it is stupid to waste so much time for stupid errors like that... I noticed this one immediately but it's like... I can not give appropriate example... I think to reach Zen you should write binary code || at least asm :) You have to see the matrix you know... D is just too high level to reach Zen with it... And I don't want crap like VB/Delphi etc where programming is drag-drop. Just a single warning... It is not so much :))
Mar 11 2005