Is this a semicolon between a method declaration and the method body?

  c++, syntax

I programmed for many years in C and C++ (I now use C#), and I ran into the following C++ code:

std::vector<BYTE> authTag(authTagLengths.dwMinLength);
{
    BCRYPT_AUTHENTICATED_CIPHER_MODE_INFO authInfo;
    BCRYPT_INIT_AUTH_MODE_INFO(authInfo);
    authInfo.pbNonce = (PUCHAR)&origNonce[0];
    authInfo.cbNonce = origNonce.size();
    authInfo.pbTag = &authTag[0];
    authInfo.cbTag = authTag.size();
    bcryptResult = BCryptEncrypt
    (
        keyHandle,
        &encrypted[0],
        encrypted.size(),
        &authInfo,
        NULL,
        NULL,
        &encrypted[0], encrypted.size(),
        &bytesDone, 0
    );
    std::cout << "Encrypted Data" << std::endl;
    for (auto val : encrypted)
    {
        std::cout << std::hex << (0xFF & val) << std::endl;
    }
}

I’m not sure what I’m looking at. authTag appears to be a method. But it’s followed by a semicolon, and then what appears to be a method body.

I’ve never seen a semicolon between the method declaration and it’s body. Can someone explain what I’m looking at here?

Source: Windows Questions C++

LEAVE A COMMENT