[FFmpeg-user] Filter documentation -- PTSs

Mark Filipak (ffmpeg) markfilipak at bog.us
Tue Feb 16 03:42:17 EET 2021


On 02/15/2021 06:47 PM, Chris Angelico wrote:
> On Tue, Feb 16, 2021 at 8:44 AM Mark Filipak (ffmpeg)
> <markfilipak at bog.us> wrote:
>>
>> On 02/15/2021 04:32 PM, Carl Zwanzig wrote:
>>> On 2/15/2021 1:26 PM, Mark Filipak (ffmpeg) wrote:
>>>> Yes, I'm aware of C++. It's sort of a 'C' language architecture hack, isn't it?
>>> More like butchery ...
>>
>> Ooooo... that's harsh.  :-)
>>
>>> Glad it's making more sense now.
>>>
>>> z!
>>
>> Thanks for the confirmation. Now, regarding pointers-to-pointers and '*' as a unary operator.....
>>
> 
> A pointer, at its core, is a number representing a place in memory. A
> pointer to a pointer is a number representing the place in memory
> where you can find another number that'll tell you where you want to
> go. You want to know where the Sword Master can be found, but I won't
> tell you where he is; all I'll tell you is that the shopkeeper knows
> where to find the Sword Master. I point you to the shopkeeper, and
> then you ask him to point you to the Sword Master.
> 
> The asterisk, as a unary operator, is one step in that process.
> Something like this:
> 
> int **trial = find_sword_master();

Oops, I'm getting lost in the story of the Sword Master. You're describing indirection. I have no 
problem with indirection. The problem I have is simply with syntax interpretation because to me, 
every variable (or constant) in every language is a location in memory, so when you write that a 
number represents a place in memory, to me it's undistinguished, it's not any different than any 
other variable (in any location in memory).

Does '*' (a unary operator) that precedes a variable's name indicate that the named variable is a 
pointer? Or do I have that bit wrong?

Is '**' also a unary operator? Or is it 2 unary operators, '*'+'*'? I suspect that '**' is the 
infamous pointer-to-pointer (i.e. doubly indirect), or do I have that bit wrong?

> "trial" is a number that says where in memory the shopkeeper is.
> What's that number?
> 
> printf("Shopkeeper is at %p\n", trial);

I have no idea what '%p' means or what you're trying to demonstrate by the code. I don't know why 
the printf has a 2nd arg: 'trial'. '%' is modulo, but modulo is a binary operator, not a unary 
operator. That it's in a string just adds to the mystery.

> "*trial" is the number that can be found there. What's that number?
> 
> printf("Sword Master is at %p\n", *trial);

Okay, now I'm lost. is 'trial' a variable or a pointer? Specifically, is '*trial' a pointer that's 
labeled "trial" or is it a pointer to a variable that's labeled "trial"? Or are both labeled 
"trial"? Or does the string "*trial" just represent an entity that's just a relative memory address 
that neither the compiler nor the runtime system normally discloses? If your 'printf' functions 
print, what do they print? ...Yes, I know that 'print' doesn't mean print on a printer. The only 
thing I can guess is that "%p" is some sort of token, but I don't know its meaning.

The rest of 'C' syntax, and precedent, and operators, etc. I know. It's just pointers that mystify 
me. Now I understand what a struct actually is but pointers?... not so much. I thought I understood, 
but '**' fuddled it. I'm afraid I'm one of the people who, for example, actually prefer BNF to 
textual descriptions.

-- 
Any journey, no matter how long, is just a series of small steps.
"Government is the problem!" -- 1982 and onward.
"_______ is the enemy of the people!" -- 2016 and onward.
"You have to fight like hell or you're not going to have a country!" -- Jan 6, 2021.
It isn't the distance that's important, it's the direction.


More information about the ffmpeg-user mailing list