-11

I'm tracing hevc code. encountered a weird function without statement:

 Void encode( Bool bEos,
               TComPicYuv* pcPicYuvOrg,
               TComPicYuv* pcPicYuvTrueOrg, const InputColourSpaceConversion snrCSC, // used for SNR calculations. Picture in original colour space.
               TComList<TComPicYuv*>& rcListPicYuvRecOut,
               std::list<AccessUnit>& accessUnitsOut, Int& iNumEncoded );

and somewhere call it :

m_cTEncTop.encode( bEos, flush ? 0 : pcPicYuvOrg, flush ? 0 : &cPicYuvTrueOrg, snrCSC, m_cListPicYuvRec, outputAccessUnits, iNumEncoded, m_isTopFieldFirst );

I can't trace forward because of this function.It doesn't do anything

Vlad from Moscow
  • 301,070
  • 26
  • 186
  • 335
  • 10
    Read a book on C++ about function declarations. – Vlad from Moscow Jan 17 '17 at 11:11
  • "*Without statement*" ? – Hatted Rooster Jan 17 '17 at 11:11
  • 2
    `Void` is not a common C++ keyword. Either it is defined (or possibly `typedef`ed) somewhere, or you copied it wrong. (Okay – it is in `TypeDef.h`, as `typedef void Void;`. Why??) – Jongware Jan 17 '17 at 11:12
  • 1
    Do you mean "without _definition_"? If yes, there _must_ be a definition _somewhere_, otherwise the code won't compile. – ForceBru Jan 17 '17 at 11:13
  • For clarity, please add what you are looking at. Is it https://github.com/dhananjay92/HEVC-Encoder-Parallel? – Jongware Jan 17 '17 at 11:18
  • 1
    @GillBates: Try reading it as "without statements", or "without any statements". Note that Chinese (and I think other East Asian languages) don't *have* plurals, so native speakers of these languages find getting plurals right *very* hard. (They also don't have articles, so they find getting those right hard too.) – Martin Bonner supports Monica Jan 17 '17 at 11:25
  • The declaration is in the header file (.h or .hpp) and the defintion is in the cpp file (https://github.com/dhananjay92/HEVC-Encoder-Parallel/blob/273067eacf187320c9450dd0bdc289a4f41a48c1/source/Lib/TLibEncoder/TEncTop.cpp) – doctorlove Jan 17 '17 at 11:27
  • @doctoriove thanks , I found the function "statement". Sorry for wasting your time. I use Eclipse too read the code. it's always unstable. I tapped Ctrl+left click on that function, It couldn't trace to where it defined. now I know where the function is. Thanks everyone. – Kevin Ym C Jan 17 '17 at 11:49

1 Answers1

3

What you're looking at is a declaration (function prototype). Somewhere, there will be a definition (function, with the same name and signature, with the statements).

If there is no definition, there will be a linker error (because there is code attempting to call it, as you've pointed out), unless the calling code has been optimised away (which I'd regard as unlikely).

I would say ... keep searching, and check each search hit carefully.

Update: It is usual to have pairs of files, eg NameOfClass.h and NameOfClass.cpp. The declaration (without statements) in the .h (header) file, the definition (with the statements) in the .cpp file.

As @Sven points out, it could also be in a library, so the situation can get a little murky. But the good C++ programmers would put the name of the library (NameOfLibrary.so or .a or .dll) at the top of their .h file(s).

Kiwi Nick
  • 150
  • 1
  • 10