Software development in c

Started by boral, June 03, 2012, 07:32:32 PM

Previous topic - Next topic

CommonTater

#15
Quote from: migf1 on June 16, 2012, 04:29:58 PM
Actually, I don't even know if and how many people are aware about this 3rd parameter of the main() function. But Google returns a bloated load of links mentioning it, when searching for "environment variables enumeration in c". In that sense, it certainly won't hurt if Pelles C would support it too ;)

Then you should put in a feature request ... Write up a little article demonstrating the need and see what happens. :D   Pelle is very good about saying "yes" or "no" to these things, which is as it should be.

migf1

Actually, I'm not concerned that much about Pelles C's support of envp, because I use mingw gcc along with Pelles.
I only mentioned it for the shake of completeness, regarding main(), because it's quite common on most c-platforms, or at least on the most popular among them.

PS. What kinda bothers me though, is the fact that I cannot close poIDE tabs by double-clicking on them (this I will officially file it as a feature request, but I have to search that it is not already filed).

CommonTater

Quote from: migf1 on June 16, 2012, 04:44:33 PM
Actually, I'm not concerned that much about Pelles C's support of envp, because I use mingw gcc along with PS. What kinda bothers me though, is the fact that I cannot close poIDE tabs by double-clicking on them (this I will officially file it as a feature request, but I have to search that it is not already filed).

Try right clicking on the tabs...

I'd rather they not close on double clicks, as a safety measure against accidental closures.

migf1

Quote from: CommonTater on June 16, 2012, 04:52:07 PM

Try right clicking on the tabs...

I'd rather they not close on double clicks, as a safety measure against accidental closures.
Right-clicking works just fine, but it slows me down so much :)
Of course I'll request it as an optional addition to the current behavior.

PS. I've hi-jacked the topic :P

migf1

Quote from: migf1 on June 16, 2012, 04:58:27 PM
PS. I've hi-jacked the topic :P

Since I've already done it  ;D , allow me to abuse it a little bit more: does version 7.00rc3 come without any pre-installed addons? I installed it today on my Win7 64bit machine and it didn't have any.

CommonTater

Quote from: migf1 on June 16, 2012, 05:14:31 PM
Quote from: migf1 on June 16, 2012, 04:58:27 PM
PS. I've hi-jacked the topic :P

Since I've already done it  ;D , allow me to abuse it a little bit more: does version 7.00rc3 come without any pre-installed addons? I installed it today on my Win7 64bit machine and it didn't have any.

Install the AddIn SDK as well... you'll get a couple of extra wizards and addins in the bargain.

migf1


Bitbeisser

Quote from: migf1 on June 16, 2012, 04:29:58 PM
Anyway, the only reason for suggesting its addition was in the case Pelle wanted Pelles C to be more compatible with MS c-runtime.
What M$ C runtime? Microsoft has pretty much abandoned C, caring only about their C++?Ccrap stuff...

Pelle's C is pretty much the only serious plain C compiler out there, and his intentions seems to to adhere to the C standards, which is perfectly fine...

Ralf

migf1

#23
Quote from: Bitbeisser on June 16, 2012, 05:59:45 PMWhat M$ C runtime? Microsoft has pretty much abandoned C, caring only about their C++?Ccrap stuff...

That's so very true!

However, VC++, C++ Builder and MinGw are very (very) popular and by default they use the MS C runtime. I thought it would be nice if Pelles could give those users one more reason to make the switch ;)

QuotePelle's C is pretty much the only serious plain C compiler out there, and his intentions seems to to adhere to the C standards,...

Ralf

No question about that!

czerny

Quote from: migf1 on June 16, 2012, 12:20:27 PM
Yeap, as I mentioned it is not standard C. However, modern posix, ms and macos-x all support it.

PS1. Not a bad idea for Pelle to also support it in future versions, too ;)

If I remember right, I had to port a third party library. In such cases it would be very handy to have this option or the POSIX variant.

Stefan Pendl

The main entry point signature is described as to support the environment block at The main Function and Program Execution at MSDN.

Since we are developing for Windows, we should have the ability to use the official signature of the main function.
---
Stefan

Proud member of the UltraDefrag Development Team

migf1

Quote from: czerny on June 16, 2012, 06:58:25 PM
...
In such cases it would be very handy to have this option or the POSIX variant.

Starting from the msdn main() link presented by Stefan Pendl, I just discovered that a corresponding char **_environ global var is also present in the MS C runtime, via <stdlib.h> (along with its wide variant, _wenviron): http://msdn.microsoft.com/en-us/library/stxk41x1%28v=vs.80%29.aspx

Although it is clearly marked as depreciated at msdn, I just tested it with the latest mingw gcc and it works just fine...


#include <stdio.h>
#include <stdlib.h>

int main( void )
{
    extern char **_environ;
    char **env = _environ;

    while ( *env )
        puts( *env++ );

    system( "pause" );
    exit(0);
}


Pelles C doesn't support it though.

Stefan Pendl

After taking a closer look the third parameter seems to be M$ VS/VC specific.

Anyways this would just be the environment block state at the start of the program, which can easily be retrieved by the GetEnvironmentStrings function.
---
Stefan

Proud member of the UltraDefrag Development Team

migf1

Quote from: Stefan Pendl on June 17, 2012, 12:03:32 AM
After taking a closer look the third parameter seems to be M$ VS/VC specific.

Yeap, it's not standard C.
But it is supported by most major c dev platforms (windows, posix, macos).

QuoteAnyways this would just be the environment block state at the start of the program, which can easily be retrieved by the GetEnvironmentStrings function.

Yes, CommonTater also pointed it out.