We’re rewarding the question askers & reputations are being recalculated! Read more.
3 added 213 characters in body
source | link

What about:

void DoSomeInterestingImageManipulation(char *pImage)
{
    convertToFormatAbc(pImage); // allows x% space savings.
    *pResult = Foo(pImage);
}

void convertToFormatAbc(char *pImage)
{
    if (internalFormatNeedsDecompression(pImage))
    {
        decompress(pImage);
    }
}

boolean internalFormatNeedsDecompression(char *pImage)
{
    return pImage && pImage[0] = 0xFF;
}

The point that I want to illustrate is that you should aim to have self-documenting code. That will require very few comments, if at all. If you need comment, always go for readability, not screen space savings.

In my opinion, comments above or at the beginning of a block of code simply means that this should be a method/class of its own.

What about:

void DoSomeInterestingImageManipulation(char *pImage)
{
    convertToFormatAbc(pImage); // allows x% space savings.
    *pResult = Foo(pImage);
}

void convertToFormatAbc(char *pImage)
{
    if (internalFormatNeedsDecompression(pImage))
    {
        decompress(pImage);
    }
}

boolean internalFormatNeedsDecompression(char *pImage)
{
    return pImage && pImage[0] = 0xFF;
}

What about:

void DoSomeInterestingImageManipulation(char *pImage)
{
    convertToFormatAbc(pImage); // allows x% space savings.
    *pResult = Foo(pImage);
}

void convertToFormatAbc(char *pImage)
{
    if (internalFormatNeedsDecompression(pImage))
    {
        decompress(pImage);
    }
}

boolean internalFormatNeedsDecompression(char *pImage)
{
    return pImage && pImage[0] = 0xFF;
}

The point that I want to illustrate is that you should aim to have self-documenting code. That will require very few comments, if at all. If you need comment, always go for readability, not screen space savings.

In my opinion, comments above or at the beginning of a block of code simply means that this should be a method/class of its own.

    Post Undeleted by Eric-Karl
2 added 71 characters in body
source | link

What about:

void DoSomeInterestingImageManipulation(char *pImage)

{//This will convert the image to formatABC which allows x% space savings for storage if(pImage && pImage[0] == 0xFF) {//Process the extra case where image internal format needs decompression ++pImage; //... //... //... }

{
    convertToFormatAbc(pImage); //Proceed normallyallows x% space savings.
    *pResult = Foo(pImage);
}

void convertToFormatAbc(char *pImage)
{
    if (internalFormatNeedsDecompression(pImage))
    {
        decompress(pImage);
    }
}

boolean internalFormatNeedsDecompression(char *pImage)
{
    return pImage && pImage[0] = 0xFF;
}

}

What about:

void DoSomeInterestingImageManipulation(char *pImage)

{//This will convert the image to formatABC which allows x% space savings for storage if(pImage && pImage[0] == 0xFF) {//Process the extra case where image internal format needs decompression ++pImage; //... //... //... }

//Proceed normally
*pResult = Foo(pImage);

}

What about:

void DoSomeInterestingImageManipulation(char *pImage)
{
    convertToFormatAbc(pImage); // allows x% space savings.
    *pResult = Foo(pImage);
}

void convertToFormatAbc(char *pImage)
{
    if (internalFormatNeedsDecompression(pImage))
    {
        decompress(pImage);
    }
}

boolean internalFormatNeedsDecompression(char *pImage)
{
    return pImage && pImage[0] = 0xFF;
}
    Post Deleted by Eric-Karl
1
source | link

What about:

void DoSomeInterestingImageManipulation(char *pImage)

{//This will convert the image to formatABC which allows x% space savings for storage if(pImage && pImage[0] == 0xFF) {//Process the extra case where image internal format needs decompression ++pImage; //... //... //... }

//Proceed normally
*pResult = Foo(pImage);

}