PDP-10 / supdup

Community maintained SUPDUP client for Unix
Other
18 stars 8 forks source link

Fix for the problem introduced by https://github.com/PDP-10/supdup/commit/d3f5019648cd14d96820599a838e4860b40a27d1#commitcomment-128203854 #34

Closed bictorv closed 2 months ago

larsbrinkhoff commented 1 year ago

Sorry, I already merged another fix one minute earlier.

bictorv commented 1 year ago

Your solution also works, but I don't see why tcp.c or chaos.c would need supdup.h. The only definition which is used from supdup.h is USE_CHAOS_STREAM_SOCKET which wraps (essentially) all of chaos.c.

larsbrinkhoff commented 1 year ago

supdup.h provides declarations of chaos_connect and tcp_connect, which are common to supcup.c, chaos.c, and tcp.c.

What I did was to move definitions out from supdup.h. It's a good idea to avoid definitions in header files, and in this case it was the cause of the problem.

bictorv commented 1 year ago

But only supdup.c needs the declarations of chaos_connect and tcp_connect, not the others. (I completely agree about keeping variable definitions out of .h files, but a #define is a definition, isn't it?)

larsbrinkhoff commented 1 year ago

It's a stylistic choice whether to have one big header file with all common declarations for the program, or many small header files each with a small scope. The former seemed to me natural with the style of supdup.c.

define's define things but are commonly kept in header files since they are only preprocessor definitions, not C definitions (if I may use the term somewhat loosely; language lawyers might disagree). Since they don't generate any code or data at the definition site, they don't have any problem with multiple definitions.