Hi,

Here is the code

bool A::clear(void) {
    if (m_active) {
      return val;
    } else {
      return true;
    }
  } // end A::clear
  
  bool A::initialize(void) {
    if (m_active) {
      return clear();
    } else {
      return true;
    }
  } // end A::initialize

getting the below segmenation fault as soon as it enters executing the clear() function
Incurred fault #6, FLTBOUNDS %pc = 0xFFFFFD7FFDE049C4
/1: siginfo: SIGSEGV SEGV_MAPERR addr=0x1FDE73940
/1: Received signal #11, SIGSEGV [caught]
/1: siginfo: SIGSEGV SEGV_MAPERR addr=0x1FDE73940

If initialize() directly returns the val, without caling the clear(), it works.
Can some help me on this

-Champa Ananad

Recommended Answers

Is val a global variable, or a class variable? It sounds like a scope issue...

Jump to Post

All 3 Replies

Member Avatar

Is val a global variable, or a class variable? It sounds like a scope issue...

Val is a class variable, if the clear() function just returns true or false, not the val , still it crashes as soon as it enters the clear() function.

-Champa

Can some one help me on this issue...

-Champa

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.20 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.