Click here to Skip to main content
15,913,722 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: _stprintf Pin
CPallini12-Oct-08 19:51
mveCPallini12-Oct-08 19:51 
QuestionCreating a file in VISTA(UAC Enabled) is retuening 5 in GetLAstError Api Pin
VCProgrammer11-Oct-08 2:26
VCProgrammer11-Oct-08 2:26 
AnswerRe: Creating a file in VISTA(UAC Enabled) is retuening 5 in GetLAstError Api Pin
krmed11-Oct-08 3:39
krmed11-Oct-08 3:39 
AnswerRe: Creating a file in VISTA(UAC Enabled) is retuening 5 in GetLAstError Api Pin
Perspx11-Oct-08 5:42
Perspx11-Oct-08 5:42 
Question#pragma check_stack in C Pin
Alok Chauhan11-Oct-08 2:01
Alok Chauhan11-Oct-08 2:01 
AnswerRe: #pragma check_stack in C Pin
Mark Salsbery11-Oct-08 6:06
Mark Salsbery11-Oct-08 6:06 
GeneralRe: #pragma check_stack in C Pin
Alok Chauhan11-Oct-08 10:39
Alok Chauhan11-Oct-08 10:39 
GeneralRe: #pragma check_stack in C Pin
Mark Salsbery11-Oct-08 11:20
Mark Salsbery11-Oct-08 11:20 
Alok Chauhan wrote:
why this #pragma check_stack exsists ?


To control stack probing (see /Gs (Control Stack Checking Calls)[^]).

This applies to stack frames[^] set up for function calls, not to recursive
function calls running off the end of the stack.

As mentioned in the /Gs docs (linked to above), you need a stack frame for a given
function that is at least 4KB (on x86 platform) for stack probing to have an effect.
Try changing your function to make a big stack frame and you'll see - it will
still fault because of the recursion, but it will happen in the stack probing code when
there's no more stack to automagically allocate for the function call:
#pragma check_stack(on)

_int64 f1(__int64 a)
{
   // make stack frame bigger than 4KB
   char arr[5000];

   if((a-1)==0)
      return 1;
   return a*f1(a-1);
}

This is a pretty advanced topic, and the default settings work
well for Windows - what are you trying to do?

Mark

Mark Salsbery
Microsoft MVP - Visual C++

Java | [Coffee]

QuestionBtree Library Pin
phap11-Oct-08 1:52
phap11-Oct-08 1:52 
AnswerRe: Btree Library Pin
sashoalm11-Oct-08 4:35
sashoalm11-Oct-08 4:35 
AnswerRe: Btree Library Pin
CPallini11-Oct-08 6:38
mveCPallini11-Oct-08 6:38 
GeneralRe: Btree Library Pin
Hamid_RT11-Oct-08 22:15
Hamid_RT11-Oct-08 22:15 
GeneralRe: Btree Library Pin
CPallini11-Oct-08 23:00
mveCPallini11-Oct-08 23:00 
GeneralRe: Btree Library Pin
Hamid_RT12-Oct-08 5:32
Hamid_RT12-Oct-08 5:32 
GeneralRe: Btree Library Pin
CPallini12-Oct-08 6:52
mveCPallini12-Oct-08 6:52 
GeneralRe: Btree Library Pin
Hamid_RT12-Oct-08 9:06
Hamid_RT12-Oct-08 9:06 
Questionsymbol missing error? Pin
George_George11-Oct-08 1:51
George_George11-Oct-08 1:51 
Questionsomething about jrtplib,help! Pin
Pearson_Bee10-Oct-08 20:51
Pearson_Bee10-Oct-08 20:51 
AnswerRe: something about jrtplib,help! Pin
Garth J Lancaster11-Oct-08 23:47
professionalGarth J Lancaster11-Oct-08 23:47 
GeneralRe: something about jrtplib,help! Pin
Pearson_Bee12-Oct-08 17:14
Pearson_Bee12-Oct-08 17:14 
GeneralRe: something about jrtplib,help! Pin
Garth J Lancaster12-Oct-08 17:35
professionalGarth J Lancaster12-Oct-08 17:35 
Question.def file in visual c++ 2008 express edition ? Pin
ganralf10-Oct-08 19:23
ganralf10-Oct-08 19:23 
AnswerRe: .def file in visual c++ 2008 express edition ? Pin
Mark Salsbery11-Oct-08 6:24
Mark Salsbery11-Oct-08 6:24 
GeneralRe: .def file in visual c++ 2008 express edition ? Pin
ganralf11-Oct-08 22:58
ganralf11-Oct-08 22:58 
GeneralRe: .def file in visual c++ 2008 express edition ? Pin
Mark Salsbery12-Oct-08 7:09
Mark Salsbery12-Oct-08 7:09 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.