Click here to Skip to main content
15,887,485 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
The C++ code below will not compile w/ error C2065: 'buffer_identifier': undeclared identifier

I do not understand why the argument passed to DEBUG_ASSERT from HANDLE_NULL_BUFFER is not replaced by the argument passed to HANDLE_NULL_BUFFER

Kindly advise Thank You

#include <cassert>

#define DEBUG_ASSERT(assert_condition) { assert(assert_condition); }
#define HANDLE_NULL_BUFFER(buffer_identifer) DEBUG_ASSERT(buffer_identifier != nullptr)

void foobar(void* buffer)
{
	HANDLE_NULL_BUFFER(buffer) // error C2065: 'buffer_identifier': undeclared identifier
}


What I have tried:

I removed much other processing resulting in this simplest demonstration of the error
Posted
Updated 15-Jul-21 19:11pm

1 solution

Spelling is all ... change:
C++
#define HANDLE_NULL_BUFFER(buffer_identifer) DEBUG_ASSERT(buffer_identifier != nullptr)
To
C++
#define HANDLE_NULL_BUFFER(buffer_identifier) DEBUG_ASSERT(buffer_identifier != nullptr)
                                         ^
                                         !
 
Share this answer
 
Comments
CPallini 16-Jul-21 2:09am    
5.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900