|
I don't agree. the synopsis of the main() function (as an application entry point), there are several syntaxes allowed, and int main(int argc, char **argv) is definitely not *THE* ultimate one.
in C, the returned type is not mandatory. if not provided, int is assumed.
and under windows, main can accept a third parameter which is an array containing the environment variables...
|
|
|
|
|
See the Besides, i think nowadays most compilers will accep that as the main entry point anyways. part in my post, but you are right, sorry for the confusement.
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
|
|
|
|
|
normally, a C++ compiler would not accept a not typed function ; so the minimal main should be int main() at least...
|
|
|
|
|
toxcct wrote: and under windows, main can accept a third parameter which is an array containing the environment variables...
Windows it's not alone, UNIX main has the above feature too.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
CPallini wrote: Windows it's not alone
and you say this to me ?!
when you're not sure, don't talk about something you don't know... that's what I did
|
|
|
|
|
toxcct wrote: and you say this to me ?!
Shouldn't I?
Why?
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
BobInNJ wrote: Please comment.
printf("%f", (double) i / *p);
"Love people and use things, not love things and use people." - Unknown
"The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch
|
|
|
|
|
As David Crow already pointed out, there is an error, but it is not a syntactic one.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
BobInNJ wrote:
p = &i;
That was a syntax error in the previous version of the C standard, comments begining with "//" were introduced in C99.
|
|
|
|
|
why in mfc programming # prgma once is used??
|
|
|
|
|
To avoid multiple inclusion of the same header file. This used to be like this:
#ifndef MY_HEADER_FILE_H__
#define MY_HEADER_FILE_H__
...
#endif
But using pragma once makes it easier.
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
|
|
|
|
|
Code-o-mat wrote:
But using pragma once makes it easier.
but not portable, it's a Microsoft specific pragma (as far as I know).
|
|
|
|
|
As far as i know you are right.
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
|
|
|
|
|
Recent versions of GNU compiler also support it.
|
|
|
|
|
Maximilien wrote: it's a Microsoft specific pragma (as far as I know).
My bad, I mistook you for the original poster! I am officially embarrassed
led mike
|
|
|
|
|
so are MFC, so it doesn't matter in this case
|
|
|
|
|
Pragma once is used to include the header file only one time when compiling. No sense in having to parse through the same header file multiple times.
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
"Not only do you continue to babble nonsense, you can't even correctly remember the nonsense you babbled just minutes ago." - Rob Graham
|
|
|
|
|
...not to mention the nice "redeclaration" and "multiple definition" errors you'd get.
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
|
|
|
|
|
Code-o-mat wrote: ...not to mention the nice "redeclaration" and "multiple definition" errors you'd get.
or even recursive inclusion
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Bisua wrote: # prgma once
To irritate the compiler.
#pragma once is not MFC specific and is even documented [^].
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Hi,
I need a Custom ComboBox with MFC GridCtrl like this from Bahrudin Hrnjica (http://www.codeproject.com/KB/combobox/CustomComboBox.aspx) not with common control version 5 but with version 6.
Compiled with VS 2002 it runs fine, compiled with VS 2008 it doesn’t run.
I found the answer, why it doesn’t run (from dragonhead7):
"I have consulted the developer support engineer of Microsoft, he said the usage of:
VERIFY(::DestroyWindow(m_pcbInfo->hwndList));
if(m_lstPopup->IsKindOf(RUNTIME_CLASS(CPopupMFCGrid)))
VERIFY(static_cast<CPopupMFCGrid>(m_lstPopup)->CreatePopupCtrl(this));
is not supported in common control version 6, although it is supported in common control version 5. He suggested to use the subclass function."
Can anyone tell me the code for common control *version 6*?
Thanks
|
|
|
|
|
My C++ project (embedded real-time stuff) has run nicely for years. Now I split off some of the code to a separate exe. I always test in debug mode, so I didn't worry much about release mode. So when the user starts it in release mode, as soon as the exe is called it comes with "The application has requested runtime to terminate it in an unusual way".
I have seen this before, it was the exe throwing an unhandled exception. But the thing has more exception handlers than code now, and it runs fine in debug. What can be causing this?
I checked the project properties, there is nothing surprising in there. Maybe someone can give me a tip what I should be looking for?
-------------
Bibo ergo sum
|
|
|
|
|
|
|
Make sure to check that any member variable pointers are in the class initialization list and set to NULL. This is usually the number one cause of the behavior you are describing, at least in my shop.
|
|
|
|