What is the difference between 'call' and 'invoke'?

As the title says. What’s the difference between invoking a function and calling a function? Is it the same thing just named differently?

Yeah, it’s the same thing.

Pretty much. You invoke a function by calling it.

I guess a distinction between them might be made as you can technically call a function without it getting invoked (for whatever reason). Just like you can try to start a car without it actually starting. But that is nitpicking semantics.

Edit: Actually now that I think about it, I’m not sure if that is really a correct distinction. At least not with the words “call” and “invoke”. Seeing as the word “invoke” is pretty much synonymous with “call”. For some reason, I just equate the actual running more with an invocation than just the call.

I vaguely remember watching a video where the distinction was made. It might have been a Jon Gjenset stream :thinking: (sounds like something he would distinguish).

IIRC, the use of the word invoke comes mainly in the context of scripts. So, it would be incorrect to say:

The bootloader calls the main function.

Instead:

The bootloader invokes the main function.

You can find the word invoke in old C specs and I’m guessing other programming languages.

The object ap may be passed as an argument to another function; if that function invokes the va_arg macro with parameter ap, the value of ap in the calling function is indeterminate and shall be passed to the va_end macro prior to any further reference to ap.

Except that it returns no value, the setbuf function is equivalent to the setvbuf function invoked with the values _IOFBF for mode and BUFSIZ for size, or (if buf is a null pointer), with the value _IONBF for mode

Depending on the context there might be a distinction. But the words “invoke” and “call” pretty much mean the same thing. I think it might be more related to the correct use of language than technical communication.

If I was to make a distinction it might be something like Call > invocation > execution


1 Like