Are conflicting types always a problem in C?

I'm getting pains going from Java to C. I'm used to the fact that I have different methods with the same name, but which take different parameters. In C, is this causing problems?

Cell makeCell(int dim, int iterations, Cell parent);

Cell makeCell(Cell parent);

Is there a little work for this problem, or should I just hold my hard upper lip and call one of them _makeCellor makeCell2or something similar funny?

+3
source share
8 answers

C, Java ++ ( , , , , ++, C kludges:-), , , .

_makeCell makeCell2, . :

Cell makeCellFromDimensionAndIteration(int dim, int iterations, Cell parent);
Cell makeCell(Cell parent);

, , . makeCell2 -, ( ).

+5

C - , ( , <tgmath.h> C99).

.

, .

+10

, C , , , , , , .

+3

. , , , . Dave Hanson C .

- :

Cell_T Cell_with_dim(int dim, int iterations, Cell_T parent);

Cell_T Cell_of_parent(Cell_T parent);

( , , ).

+2

, , - :

Cell makeCell(Cell parent, int dim, int iterations);

" ", . :

cell = makeCell(par,-1,-1);

, , :

Cell makeCell(Cell parent, ...);

, "", , " ", .

( ), :

Cell makeCell(Cell parent);
Cell setCell(Cell cell, int dim, int iterations);

, - , . , "", .

+2

, C , C, - , , . , : http://en.wikipedia.org/wiki/Stdarg.h

, , C. , printf(), kludges. , .

+1

Java, ++ , C. ++, ?

0

, C. ( tgmath.h). tgmath.h GCC, hack-o-meter. , ,

/* This is ugly but unless gcc gets appropriate builtins we have to do
 something like this. Don't ask how it works. */

. OpenGL, , , :

glVertex3f

, 3 .

0

Source: https://habr.com/ru/post/1703858/


All Articles