Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Apr 18th, 2006, 12:04 AM   #1
rsnd
Hobbyist Programmer
 
rsnd's Avatar
 
Join Date: Jun 2005
Location: Helltown
Posts: 162
Rep Power: 4 rsnd is on a distinguished road
yet another vc++ question

hmmm...i hate these warning messages

dis is the list of warnings I get:
G:\n02\ServerDialog.cpp(6) : warning C4518: 'int ' : storage-class or type specifier(s) unexpected here; ignored
G:\n02\ServerDialog.cpp(6) : warning C4230: anachronism used : modifiers/qualifiers interspersed, qualifier ignored
G:\n02\ServerDialog.cpp(8) : warning C4508: 'kailleraSelectServerDialog' : function should return a value; 'void' return type assumed

for my code:
#include "windows.h"
//#include "n02.h"


__stdcall int kailleraSelectServerDialog(HWND parent){

}

why does it ignore type specifier and then complain it doesnot exist? why is the type specifier ignored in the first place? am I doing something wrong?

Thanks in advance
- Visual c++ 6.0
__________________
Spread your wings and fly! Chicken!
rsnd is offline   Reply With Quote
Old Apr 18th, 2006, 3:48 AM   #2
The Dark
Expert Programmer
 
Join Date: Jun 2005
Posts: 893
Rep Power: 4 The Dark is on a distinguished road
The __stdcall specifier needs to go after the type of the return value.
Quote:
Originally Posted by msdn
return-type __stdcall function-name[(argument-list)]
So you need to have
int __stdcall kailleraSelectServerDialog(HWND parent){
The Dark is offline   Reply With Quote
Old Apr 18th, 2006, 4:59 AM   #3
nnxion
Programming Guru
 
nnxion's Avatar
 
Join Date: Jun 2005
Location: elemental plane
Posts: 1,429
Rep Power: 5 nnxion is on a distinguished road
Can't you instead do?:
int WINAPI kailleraSelectServerDialog(HWND parent){
I thought that would decide the right calling convention.
__________________
"Employ your time in improving yourself by other men's writings, so that you shall gain easily what others have labored hard for."
-- Socrates
nnxion is offline   Reply With Quote
Old Apr 18th, 2006, 9:42 AM   #4
DaWei
Resident Grouch
 
DaWei's Avatar
 
Join Date: Jun 2005
Posts: 6,453
Rep Power: 10 DaWei is on a distinguished road
Well, the order was the problem, as The Dark pointed out, and substituting WINAPI does precisely what, given that:

#define WINAPI __stdcall
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code.
Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers
DaWei is offline   Reply With Quote
Old Apr 18th, 2006, 10:21 PM   #5
rsnd
Hobbyist Programmer
 
rsnd's Avatar
 
Join Date: Jun 2005
Location: Helltown
Posts: 162
Rep Power: 4 rsnd is on a distinguished road
in visual c++...does __stdcall do more than just calling convention for the function? Some guy has his dll protos declared as:
__declspec(dllexport) WINAPI kailleraModifyPlayValues(void *values, int size);
//is the same as: 
//__declspec(dllexport) __stdcall kailleraModifyPlayValues(void *values, int size);
And the function is supposed to and does return an integer value.
__________________
Spread your wings and fly! Chicken!
rsnd is offline   Reply With Quote
Old Apr 19th, 2006, 12:47 AM   #6
The Dark
Expert Programmer
 
Join Date: Jun 2005
Posts: 893
Rep Power: 4 The Dark is on a distinguished road
I think those declarations are just missing the return type, so it is assumed to be returning an int. This would probably only work when you are compiling a C file, rather than a C++ file. Otherwise Visual Studio 8 puts out the following warning:

error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
The Dark is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 2:17 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC