Search:
Forum
Beginners
semicolon just after if() ?
semicolon just after if() ?
Jun 2, 2015 at 6:33pm UTC
Knightrider29
(47)
Please explain what the 2nd line means when we put a semi colon just after if(...)
1
2
3
4
if
(m_dataOffset) {
if
(write(1, m_data, m_dataOffset)); m_dataOffset = 0; }
Jun 2, 2015 at 6:40pm UTC
shadowmouse
(539)
That if is pointless as a semicolon negates the effect of the if (although the write() is performed), so m_dataOffset will always be set to 0 as long as the first if is true.
Jun 2, 2015 at 6:54pm UTC
Peter87
(11235)
A statement that consists only of a a semicolon is called a
null statement
and it will do nothing.
Topic archived. No new replies allowed.
C++
Information
Tutorials
Reference
Articles
Forum
Forum
Beginners
Windows Programming
UNIX/Linux Programming
General C++ Programming
Lounge
Jobs