Please help beginner

W

Wong

static const char assertFileName[] = __FILE__;

Assert();

This is normally found in applications, what does this mean ?
Thanks in advance.
 
R

Robert Gamble

static const char assertFileName[] = __FILE__;

Assert();

This is normally found in applications, what does this mean ?
Thanks in advance.

Assuming you mean the standard assert function (all lowercase), it is
used for debugging purposes to print information about where the
tested condition failed and abort the program if a condition that should
never fail does. More information here:
http://members.aol.com/wantondeb/#ASSERT and of course in the standard.
You need to include assert.h as well.

I suggest you get a good C reference or learn how to use google.

Rob Gamble
 
M

Malcolm

Wong said:
static const char assertFileName[] = __FILE__;

Assert();

This is normally found in applications, what does this mean ?
static - if global, variable visible in this file only.
- if in a function, hold in permanent storage (do not destroy when
function returns).

const - the variable is read-only.

char - the variable is of character type.

assertFileName - call the variable "assertFileName"

[] - it is an array of unspecified size (big enough to hold initialiser).

= - initialise it.

__FILE__ - a special symbol which the compiler expands to the name of the
current file.

; - C statement terminator.


Assert().

Look up the stdlib function "assert()". Often you will find that in real
code people do not use the assert() provided, but a similar function with a
similar name. Capitalising the first letter is a common way of doing this.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Can't solve problems! please Help 0
Arduino Code Please Help 0
Help please! 1
Please help 1
Please help me!!! 3
Code help please 4
Need help in debugging tic tac toe (beginner) 2
Help! (Beginner) 2

Members online

No members online now.

Forum statistics

Threads
474,146
Messages
2,570,832
Members
47,374
Latest member
EmeliaBryc

Latest Threads

Top