Warning: mysqli::__construct(): (HY000/1203): User howardkn already has more than 'max_user_connections' active connections in D:\Inetpub\vhosts\howardknight.net\al.howardknight.net\includes\artfuncs.php on line 21
Failed to connect to MySQL: (1203) User howardkn already has more than 'max_user_connections' active connections
Warning: mysqli::query(): Couldn't fetch mysqli in D:\Inetpub\vhosts\howardknight.net\al.howardknight.net\index.php on line 66
Article <vin4su$49a6$1@dont-email.me>
Deutsch   English   Français   Italiano  
<vin4su$49a6$1@dont-email.me>

View for Bookmarking (what is this?)
Look up another Usenet article

Path: ...!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: David Brown <david.brown@hesbynett.no>
Newsgroups: comp.lang.c
Subject: Re: question about linker
Date: Tue, 3 Dec 2024 15:34:05 +0100
Organization: A noiseless patient Spider
Lines: 120
Message-ID: <vin4su$49a6$1@dont-email.me>
References: <vi54e9$3ie0o$1@dont-email.me> <viaqh0$nm7q$1@dont-email.me>
 <877c8nt255.fsf@nosuchdomain.example.com> <viasv4$nm7q$2@dont-email.me>
 <vibr1l$vvjf$1@dont-email.me> <vic73f$1205f$1@dont-email.me>
 <20241129142810.00007920@yahoo.com> <vicfra$13nl4$1@dont-email.me>
 <20241129161517.000010b8@yahoo.com> <vicque$15ium$2@dont-email.me>
 <vid110$16hte$1@dont-email.me> <87mshhsrr0.fsf@nosuchdomain.example.com>
 <vidd2a$18k9j$1@dont-email.me> <8734j9sj0f.fsf@nosuchdomain.example.com>
 <vidnp3$1ovvm$2@paganini.bofh.team> <vihpjh$2hgg1$1@dont-email.me>
 <vihrh1$2hk5l$1@dont-email.me> <vii0jp$2jkd9$1@dont-email.me>
 <viifv8$2opi7$1@dont-email.me> <vik28b$390eg$1@dont-email.me>
 <vik8tc$3ang9$1@dont-email.me> <vikjff$3dgvc$1@dont-email.me>
 <viku00$3gamg$1@dont-email.me> <vil0qc$3fqqa$3@dont-email.me>
 <vil82t$3ie9o$2@dont-email.me> <vila9j$3j4dg$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Tue, 03 Dec 2024 15:34:07 +0100 (CET)
Injection-Info: dont-email.me; posting-host="45d82f8154cbe9004813104a252e0aff";
	logging-data="140614"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX1/rLpkSMGmEK6iZVuz+DxoP/w1T1u/FOMo="
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101
 Thunderbird/102.11.0
Cancel-Lock: sha1:/Ziyo2cQa15zuGWwB5ryz0EQyRY=
In-Reply-To: <vila9j$3j4dg$1@dont-email.me>
Content-Language: en-GB
Bytes: 7456

On 02/12/2024 22:53, Bart wrote:
> On 02/12/2024 21:16, David Brown wrote:
>> On 02/12/2024 20:12, Bart wrote:
>>> On 02/12/2024 18:23, Janis Papanagnou wrote:
>>>> On 02.12.2024 16:24, David Brown wrote:
>>>>> On 02/12/2024 13:24, Bart wrote:
>>>>>> [...]
>>>>>
>>>>> That sounds like you have a very poor organisation of your files. 
>>>>> [...]
>>>>
>>>> A suspicion that I got as well (also from other posts of him).
>>>
>>> Then you'd both be wrong. DB's remark was anyway a misunderstanding.
>>>
>>> My projects have all relevant modules, usually measured in dozens, in 
>>> the same folder.
>>>
>>
>> Oh, dozens of modules!  I never realised your programs were that big!
> 
>> In my current project, there are 155 C files, 44 C++ files, 272 header 
>> files, and 5 linker files over 71 directories.  Most of the C files 
>> and a substantial proportion of the headers are libraries and SDKs for 
>> the device in use, most of the C++ files were written by me, but some 
>> were written by four other developers at the same time.
>>
>> When you work with more serious projects, you need a better 
>> organisation than you do for little one-man hobby programs.
> 
> So, how would you have organised the 16-module example I posted 
> elsewhere? (Not a C project, these are 16 source files, so no headers etc.)
> 
> Because two posters here have suggested my organisation is poor, but 
> without knowing how big, small, or complex my projects are.

No one (as far as I have noticed) have said that your organisation /is/ 
poor - they have said it /sounds/ poor from the way you describe it. 
The difference is very significant.

For file organisation, I'd likely have all the modules in one directory 
unless there is a particular reason to split them up.  I would not have 
any non-project files in that directory.

But the questions raised about your organisation was not a matter of 
where you store your files, or how they are divided in directories.  It 
is about how you organise the code and split functionality between files 
(or directories, for bigger projects).

What you have described is modules that have far too much in one file, 
modules with little or no structure as to where things are in the file, 
little to no structure or control over which modules use facilities from 
which other modules, and completely random inter-module dependencies 
which can happily be circular.

These opinions are formed from how you describe your code and your language.

> 
> BTW your project doesn't sound that big, especially if you have a 
> penchant for having a larger number of smaller files.
> 
> A line-count would give a better idea.
> 

For the whole project (relevant to things like the build and the 
organisation):

-----------------------------------------------------------------------
Language             files          blank        comment           code
-----------------------------------------------------------------------
C                      155          13849          34547          80139
C/C++ Header           284          13719          62329          61056
C++                     43           2447           1230          13009
-----------------------------------------------------------------------
SUM:                   482          30015          98106         154204
-----------------------------------------------------------------------


For the project-specific code, rather than libraries, SDK, etc.:

-----------------------------------------------------------------------
Language             files          blank        comment           code
-----------------------------------------------------------------------
C++                     39           2217           1020          11820
C/C++ Header            44           1078            798           2696
C                        3            259            237           1152
-----------------------------------------------------------------------
SUM:                    86           3554           2055          15668
------------------------------------------------------------------------


> The largest C project I attempted to build (with my compiler) was the 
> Seed7 language a few years ago. I think there were 130-odd .c files, 
> probably a comparable number of header files.
> 
> It took my compiler 1-2 seconds to build from scratch, producing I think 
>   a 1.6MB executable. (That project is notable for coming with nearly 20 
> different makefiles, tuned for different compilers and platforms.)
> 
> The current version includes 176 .c files and 148 .h files (not all used 
> in any one configuration), which are all kept in one ./src folder. About 
> 190Kloc in all.
> 
> I guess that's poorly organised too? It sounds like everybody else's 
> projects are!
> 

I have no idea how good or bad organisation that project is - I don't 
know enough about it to tell.  But 200+ files in one directory does not 
sound like a good start.  (Note again that I can only judge the
/appearance/ of poor organisation of your projects from your own 
descriptions.)

Not that it really matters, but a typical build for my project takes 
about 1 to 3 seconds.  There are 18 binary images produced in the build 
- three different sets of builds (each with their own tree of object 
files from compiling with different options for the different but 
closely related programs) along with a number of variations of link 
setups and post-processing.