0

Please refer to the attached screenshot of two different implementations of a JPEG library file (linux/windows). Filename is /libijg12/jcarith.c

One of them has an extra macro, both have the same function name.

My question is: Does the first version is overridden by the second one?

enter image description here

Jaime
  • 5,770
  • 4
  • 23
  • 50
  • Is the first version the one on the left and the new version the one on the right? –  Dec 24 '21 at 22:52
  • In the one on the right, the first is the declaration (or prototype) of the function defined below. It's unclear what the question is. Overridden by what? – Weather Vane Dec 24 '21 at 22:54
  • @Jellyboy as mentioned, they are not old/new but linux/windows (left/right) – Jaime Dec 24 '21 at 23:19
  • @WeatherVane in the linux version (left) the first statement is missing. So I wondering whether it is really required. If not, can I remove it safely from the windows implementation? – Jaime Dec 24 '21 at 23:22
  • You can safely leave it there. – Weather Vane Dec 24 '21 at 23:30
  • @WeatherVane I don't wanna leave it, I want to remove it :) – Jaime Dec 24 '21 at 23:37
  • Once you start tampering with the third-party library code, that's the thin end of the wedge towards breaking them. It's harmless, leave it alone. – Weather Vane Dec 24 '21 at 23:39

1 Answers1

2

In the one in the right (Windows) the top one is just a declaration or prototype, it does not include the body of the function. Declarations come usually in headers. In this case, it's unusual that the author put the declaration together with the definition of the function. The opposite is more common - to place the body of a function in the header (inlined).

  • 2
    In particular, putting the declaration of a function one line before the definition accomplishes exactly nothing. – Mark Ransom Dec 25 '21 at 01:33