Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
634 views
in Technique[技术] by (71.8m points)

c++ - Backslash newline at end of file warning

With this code:

#include <iostream>


int main(int argc, char *argv[])
{

  return 0;
}


/** run2: A macro to call a function. */
#define run2( function, ctype, dim ) 
if ( operation == #function ) 
{ 
  if ( componentType == #ctype && Dimension == dim ) 
  { 
    typedef itk::Image< ctype, dim > ImageType; 
    function< ImageType >( inputFileName, outputFileName, radius, algorithm, useCompression ); 
    supported = true; 
  } 
}

I get a warning: backslash-newline at end of file

Any idea how to make it go away?

David

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

The problem is that there's no new-line character in the end of your code. C++ Standard §2.1/2 says:

<...>If a source file that is not empty does not end in a new-line character, or ends in a new-line character immediately preceded by a backslash character, the behavior is undefined.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...