User forums > Using Code::Blocks

Issues with Syntax Highlighting ans Code Completion

<< < (3/3)

scarphin:

--- Quote from: ollydbg on February 29, 2012, 02:45:44 pm ---
--- Code: ---int fff( int a, float b); //This is a declaration

int fff( int c, float d)  //function implementation
{
}
--- End code ---
Those two should match.

--- End quote ---
Yup, they should match for sure but afaik compiler discards the argument names defined in function declarations without any 'match' checking and only cares about the ones defined in function definitions. So the code below is a valid code and can be compiled without any error. Regarding this fact I can't think of any case that argument names in function declarations must have priority.

--- Code: ---#include <iostream>

using namespace std;

void testFunction(int* somePtr, int otherName=0); // Declaration.

int main()
{
int *ptrToInt;

testFunction(ptrToInt);

    return 0;
}

void testFunction(int* iPtr, int param) // Definition.
{
iPtr=NULL; // 'iPtr' is the designated name for the 1st argument instead of 'somePtr'!

cout<< "Test";
}
--- End code ---

I can't believe that bug lasted that long without being spotted. Or is it a known bug? I guess majority of the CB users define argument names in declarations. ;/

ollydbg:
FYI:

--- Quote ---Revision: 8889
Author: ollydbg
Date: 2013-3-1 11:04:22
Message:
*CC: commit patch #3408 to fix bug #18559 (CC doesn't work on function arguments), thanks p2rkw. See some discussion in http://forums.codeblocks.org/index.php/topic,16024.msg108174.html#msg108174.
-------------------------------
M : /trunk/src/plugins/codecompletion/parser/parserthread.cpp



--- End quote ---

Navigation

[0] Message Index

[*] Previous page

Go to full version