July 28, 2022

On Thursday, 28 July 2022 at 12:15:19 UTC, kdevel wrote:

>

On Wednesday, 27 July 2022 at 18:19:34 UTC, pascal111 wrote:

>

[...]

  1. What exact purpose do these
/******************************************/

[...]

Aha! you mean "/******************************************/", it has no job, just to separate between functions codes.

July 28, 2022

On Thursday, 28 July 2022 at 12:26:50 UTC, pascal111 wrote:

>

[...]
Aha! you mean "/******************************************/", it has no job, just to separate between functions codes.

Do you think it helps the compiler if you put these

/******************************************/

between your functions? Or is there anybody else who benefits from it?

July 28, 2022

On Thursday, 28 July 2022 at 12:36:59 UTC, kdevel wrote:

>

On Thursday, 28 July 2022 at 12:26:50 UTC, pascal111 wrote:

>

[...]
Aha! you mean "/******************************************/", it has no job, just to separate between functions codes.

Do you think it helps the compiler if you put these

/******************************************/

between your functions? Or is there anybody else who benefits from it?

"Do you think it helps the compiler if you put these"
Are you serious? maybe it's useful for compilers with some way.

"between your functions? Or is there anybody else who benefits
 from it?"

Your question isn't clear, but the code is free for learning purposes. I shared it in public for everyone thinks it useful to him.

July 28, 2022

On Thursday, 28 July 2022 at 12:25:05 UTC, pascal111 wrote:

>

[...]

>

ofix.c: In function 'fix':
ofix.c:7:3: warning: 'z' is used uninitialized [-Wuninitialized]
7 | y=modf(x,z);
| ^~~~~~~~~
ofix.c:5:12: note: 'z' was declared here
5 | double y,* z;
| ^


I would also like to complain about the double assignment to `y`.

"fix" function is the C version of BASIC standard one I made, it's the equivalent of "trunc" in D, but the code I programmed for "fix" was with TC++ , and it worked in DOS emulators with no problem,

"Code works" and "Code is correct" are two distinct categories. The compiler's warnings show that your code is not correct and not that it will necessarily not work. Incorrect code may work accidentally.

As a (future) software developer you are required to not just produce code that "works" "with no problem" but also code that is correct. "Correct" here means that the code adheres to the specifications of the language.

Writing incorrect code is like "fixing" a "broken" fuse with tin foil.

>

I have no idea how gcc will treat my code, but I think you are right that some other compilers will refuse such code, because VC++ 6 refused many of these functions codes I programmed with TC++ compiler.

The incorrectness of your C code does not depend on the compiler brand.

July 28, 2022

On Thursday, 28 July 2022 at 12:44:19 UTC, pascal111 wrote:

> >

[...]
Do you think it helps the compiler if you put these

/******************************************/

between your functions? Or is there anybody else who benefits from it?

"Do you think it helps the compiler if you put these"
Are you serious? maybe it's useful for compilers with some way.

Precisely in what way? I am not kidding. I am seriously asking the question: In what way may a C or C++ compiler benefit from lines between functions which contain only comments consisting of nothing else than asterisks?

July 28, 2022

On Thursday, 28 July 2022 at 13:06:03 UTC, kdevel wrote:

>

On Thursday, 28 July 2022 at 12:25:05 UTC, pascal111 wrote:

>

[...]

>

ofix.c: In function 'fix':
ofix.c:7:3: warning: 'z' is used uninitialized [-Wuninitialized]
7 | y=modf(x,z);
| ^~~~~~~~~
ofix.c:5:12: note: 'z' was declared here
5 | double y,* z;
| ^


I would also like to complain about the double assignment to `y`.

"fix" function is the C version of BASIC standard one I made, it's the equivalent of "trunc" in D, but the code I programmed for "fix" was with TC++ , and it worked in DOS emulators with no problem,

"Code works" and "Code is correct" are two distinct categories. The compiler's warnings show that your code is not correct and not that it will necessarily not work. Incorrect code may work accidentally.

for that we are - guys of C - prefer C of other languages like Pascal, because C allow us to have working programs although they are not 100% correct, but something like Pascal is so hard and difficult in its compiling, it'll give us an error for even a so small expression, so we don't like the much complaints of compilers, and C is so forgiving language.

>

As a (future) software developer you are required to not just produce code that "works" "with no problem" but also code that is correct. "Correct" here means that the code adheres to the specifications of the language.

Writing incorrect code is like "fixing" a "broken" fuse with tin foil.

>

I have no idea how gcc will treat my code, but I think you are right that some other compilers will refuse such code, because VC++ 6 refused many of these functions codes I programmed with TC++ compiler.

The incorrectness of your C code does not depend on the compiler brand.

I have to change the compiler, not the code!

July 28, 2022

On Thursday, 28 July 2022 at 13:29:01 UTC, kdevel wrote:

>

On Thursday, 28 July 2022 at 12:44:19 UTC, pascal111 wrote:

> >

[...]
Do you think it helps the compiler if you put these

/******************************************/

between your functions? Or is there anybody else who benefits from it?

"Do you think it helps the compiler if you put these"
Are you serious? maybe it's useful for compilers with some way.

Precisely in what way? I am not kidding. I am seriously asking the question: In what way may a C or C++ compiler benefit from lines between functions which contain only comments consisting of nothing else than asterisks?

Seriously and accurately, if you meant that, we don't know how developers of C compilers programmed their compilers, for example, maybe there's a secret way the developers programmed their compiler so that a special pattern of comments can have a particular meaning to the compilers. We don't know! maybe it's true.

July 28, 2022

On Thursday, 28 July 2022 at 13:58:24 UTC, pascal111 wrote:
[...]

> >

Precisely in what way? I am not kidding. I am seriously asking the question: In what way may a C or C++ compiler benefit from lines between functions which contain only comments consisting of nothing else than asterisks?

Seriously and accurately, if you meant that, we don't know how developers of C compilers programmed their compilers, for example, maybe there's a secret way the developers programmed their compiler so that a special pattern of comments can have a particular meaning to the compilers. We don't know! maybe it's true.

Sure. What effect do YOU hope to causes or prevent by writing

/******************************************/

between all of your functions?

July 28, 2022

On Thursday, 28 July 2022 at 14:44:53 UTC, kdevel wrote:

>

On Thursday, 28 July 2022 at 13:58:24 UTC, pascal111 wrote:
[...]

> >

Precisely in what way? I am not kidding. I am seriously asking the question: In what way may a C or C++ compiler benefit from lines between functions which contain only comments consisting of nothing else than asterisks?

Seriously and accurately, if you meant that, we don't know how developers of C compilers programmed their compilers, for example, maybe there's a secret way the developers programmed their compiler so that a special pattern of comments can have a particular meaning to the compilers. We don't know! maybe it's true.

Sure. What effect do YOU hope to causes or prevent by writing

/******************************************/

between all of your functions?

I'm normal programmer, by mean that I'm not so expert in C matters to know really if there are particular patterns that have specific meanings for the compiler or not. I know this forum is not for political topics, but by the way I would like to mention something: everyone knows that the affairs are not well between US and some other countries like "Russia", and they are using US products like C compilers, so with some way we have a doubt that US developed compilers with a way to accept kind of messages or something like that, so my comment has no meaning to the compiler except if I knew the secret patterns or I do it accidentally.

July 28, 2022

On Thursday, 28 July 2022 at 14:57:36 UTC, pascal111 wrote:

> >

[...]
Sure. What effect do YOU hope to causes or prevent by writing

/******************************************/

between all of your functions?

I'm normal programmer, by mean that I'm not so expert in C matters to know really if there are particular patterns that have specific meanings for the compiler or not.

I was asking why /you/ put

/******************************************/

between function definitions. You cannot or do not want to answer that question. I think that this pattern or habit is not your invention. You borrowed that style from someone else and did not ask him or her for its purpose. Right?