help-gplusplus
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

strange behavior in g++ 2.96


From: Srini
Subject: strange behavior in g++ 2.96
Date: 11 Aug 2005 20:52:22 -0700
User-agent: G2/0.2

Hello,

The following program is behaving differently when executed directly
and within gdb. While the direct execution seg faults, within gdb, it
says that the program exited normally. Am I missing something here? The
program must seg fault - I checked it in VC++ also. How is it that gdb
says program exited normally?

#include <iostream>

int main()
{
  char *p="hai friends",*p1;
  p1=p;
  while(*p!='\0') ++*p++;
  std::cout << p1; 
  return 0; 
}

TIA
Srini



reply via email to

[Prev in Thread] Current Thread [Next in Thread]