Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7556021
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T11:46:01+00:00 2026-05-30T11:46:01+00:00

I am reading some code sample that sounds odd to me: Method argument is

  • 0

I am reading some code sample that sounds odd to me:

Method argument is a pointer to double. In method body, there a conditional statement testing whether this argument pointer is given or not (empty or not). I wonder how the pointer can have a bool value, and what is the syntax for non-existant pointer (NULL? 0?).

Here is the method implementation :

bool OMethod::initSim(double* alpha_)
{
int i, j;
const double * cparameters = fun->getParameters();
simplex = OMatrix::allocMatrix(npts,ndim,true);
sSum = new double[ndim];
funcEvals = new double[npts]; 
double *alpha = 0;
     if(!alpha_) {
alpha = new double[ndim];
    for(i = 0; i< ndim; ++i) {
    if(cparameters[i] == 0)
        alpha[i] = 0.2f;
    else
        alpha[i] = 0.1 * cparameters[i];
        }
}
else
{
    alpha = alpha_;
}

     for(j = 0; j < npts; ++j) 
 {
    for(i = 0; i < ndim; ++i)
    sim[j][i] = cparameters[i]
      }

delete [] cparameters;

for(j = 0; j < ndim; ++j)
{
    sim[j + 1][j] += alpha[j];
}

computeS();

for(i = 0; i < npts; ++i) 
{
    funcEvals[i] = evalFunc(simplex[i]);    
    }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T11:46:03+00:00Added an answer on May 30, 2026 at 11:46 am

    In C++, a pointer value is considered “true” in a boolean context (e.g. in an if test or ! expression) when it is not equal to zero, i.e. it is not null. So, !alpha is the same as alpha == 0, alpha == NULL and alpha == nullptr.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm reading some C code like that: double function( int lena,double xa,double ya, double
I have a python ndarray temp in some code I'm reading that suffers this:
I am reading WIX script written by others. There are some code really confuses
I`m reading the code of some open source project. I see that in one
I'm looking at writing some code that performs shadow mapping, in DX9. The sample
Okay, I'm reading about Linux kernel development and there are some code snippets using
when I'm reading some c++ sample code for beginner , I'm puzzled at the
Can anyone provide sample pseudocode or share some existing link that has sample code.
I'm reading some code in the Ogre3D implementation and I can't understand what a
I have been reading over some code lately and came across some lines such

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.