Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c > #8591

Re: compile C programs for both sunstudio and Visual studio

From Keith Thompson <kst-u@mib.org>
Newsgroups comp.lang.c
Subject Re: compile C programs for both sunstudio and Visual studio
Date 2011-07-22 09:42 -0700
Organization None to speak of
Message-ID <lnei1ijmgi.fsf@nuthaus.mib.org> (permalink)
References (2 earlier) <j01coc$ufi$1@news.m-online.net> <pan.2011.07.18.23.41.33.648000@nowhere.com> <98jv20F8muU1@mid.individual.net> <lnd3h7m399.fsf@nuthaus.mib.org> <87sjpyttlu.fsf@bazspaz.fatphil.org>

Show all headers | View raw


Phil Carmody <thefatphil_demunged@yahoo.co.uk> writes:
> Keith Thompson <kst-u@mib.org> writes:
>> Ian Collins <ian-news@hotmail.com> writes:
>> > On 07/19/11 11:41 AM, Nobody wrote:
>> >> On Mon, 18 Jul 2011 15:34:03 +0200, Heinrich Wolf wrote:
>> >>> clear() is defined on Unix in curses.h
>> >>
>> >> If you just need to clear the screen, linking against curses is overkill.
>> >> system("clear") is the way to go here (and the usual warnings about
>> >> system() don't really apply here).
>> >
>> > Why is using a library function "overkill" compared to spawning a new 
>> > process just to clear the screen?
>> 
>> Perhaps because curses tends to be used by programs that need
>> complete control over the screen, including keeping track of what
>> character appears at every position, whereas clearing the screen
>> is a much simpler operation.
>> 
>> The time it takes to spawn a process isn't likely to be significant.
>
> What if the spawning of the process will cause cgroups to notify 
> a user-space agent which will then potentially do re-jigging of
> other processes properties? You're context switching all over the
> place unnecessarily.

Yes, and?  Does this cause measurable harm?

> However, one technique I've seen in the past is to use system() to
> call 'clear' or whatever, but rather than letting what it produces
> just go to the controlling terminal, it's been read into the C program
> and cached. Then to actually clear the screen, you just print out
> the cached sequence. That at least reduces your system()s to 1.

Yes, I think I've used that myself.

-- 
Keith Thompson (The_Other_Keith) kst-u@mib.org  <http://www.ghoti.net/~kst>
Nokia
"We must do something.  This is something.  Therefore, we must do this."
    -- Antony Jay and Jonathan Lynn, "Yes Minister"

Back to comp.lang.c | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

compile C programs for both sunstudio and Visual studio happytoday <ehabaziz2001@gmail.com> - 2011-07-17 22:49 -0500
  Re: compile C programs for both sunstudio and Visual studio Ben Bacarisse <ben.usenet@bsb.me.uk> - 2011-07-18 12:34 +0100
    Re: compile C programs for both sunstudio and Visual studio "Heinrich Wolf" <invalid@invalid.invalid> - 2011-07-18 15:34 +0200
      Re: compile C programs for both sunstudio and Visual studio Ben Bacarisse <ben.usenet@bsb.me.uk> - 2011-07-18 14:53 +0100
        Re: compile C programs for both sunstudio and Visual studio Virchanza <virtual@lavabit.com> - 2011-07-18 07:31 -0700
          Re: compile C programs for both sunstudio and Visual studio Ben Bacarisse <ben.usenet@bsb.me.uk> - 2011-07-18 15:38 +0100
            Re: compile C programs for both sunstudio and Visual studio Kenneth Brody <kenbrody@spamcop.net> - 2011-07-18 14:08 -0400
              Re: compile C programs for both sunstudio and Visual studio Ben Bacarisse <ben.usenet@bsb.me.uk> - 2011-07-18 19:18 +0100
      Re: compile C programs for both sunstudio and Visual studio Nobody <nobody@nowhere.com> - 2011-07-19 00:41 +0100
        Re: compile C programs for both sunstudio and Visual studio Ian Collins <ian-news@hotmail.com> - 2011-07-19 11:47 +1200
          Re: compile C programs for both sunstudio and Visual studio Keith Thompson <kst-u@mib.org> - 2011-07-18 19:08 -0700
            Re: compile C programs for both sunstudio and Visual studio Phil Carmody <thefatphil_demunged@yahoo.co.uk> - 2011-07-22 14:58 +0300
              Re: compile C programs for both sunstudio and Visual studio Keith Thompson <kst-u@mib.org> - 2011-07-22 09:42 -0700
                Re: compile C programs for both sunstudio and Visual studio Phil Carmody <thefatphil_demunged@yahoo.co.uk> - 2011-07-22 22:32 +0300
                Re: compile C programs for both sunstudio and Visual studio Keith Thompson <kst-u@mib.org> - 2011-07-22 13:16 -0700
          Re: compile C programs for both sunstudio and Visual studio Nobody <nobody@nowhere.com> - 2011-07-19 12:56 +0100
    Re: compile C programs for both sunstudio and Visual studio Kenneth Brody <kenbrody@spamcop.net> - 2011-07-18 14:06 -0400
    Re: compile C programs for both sunstudio and Visual studio Keith Thompson <kst-u@mib.org> - 2011-07-18 11:11 -0700
  Re: compile C programs for both sunstudio and Visual studio Geoff <geoff@invalid.invalid> - 2011-07-18 18:06 -0500
  Re: compile C programs for both sunstudio and Visual studio "Waldek M." <wm@localhost.localdomain> - 2011-07-18 18:07 -0500
  Re: compile C programs for both sunstudio and Visual studio BGB <cr88192@hotmail.com> - 2011-07-18 18:07 -0500
  Re: compile C programs for both sunstudio and Visual studio "io_x" <a@b.c.invalid> - 2011-07-19 17:40 -0500
    Re: compile C programs for both sunstudio and Visual studio "io_x" <a@b.c.invalid> - 2011-07-20 10:43 +0200
    Re: compile C programs for both sunstudio and Visual studio "io_x" <a@b.c.invalid> - 2011-07-30 01:48 -0500
    Re: compile C programs for both sunstudio and Visual studio Kenneth Brody <kenbrody@spamcop.net> - 2011-07-30 01:48 -0500
  Re: compile C programs for both sunstudio and Visual studio "io_x" <a@b.c.invalid> - 2011-07-19 17:40 -0500

csiph-web