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


Groups > comp.lang.c++ > #121014

Re: Interesting results

From wij <wyniijj5@gmail.com>
Newsgroups comp.lang.c++
Subject Re: Interesting results
Date 2024-11-26 03:41 +0800
Organization A noiseless patient Spider
Message-ID <e201a745af9f268306bdedfd9d765ed3ca24094d.camel@gmail.com> (permalink)
References <vhvk6i$2a5nc$1@raubtier-asyl.eternal-september.org> <ad2ab6d192a7614cd923b30914a3a176de5018d1.camel@gmail.com>

Show all headers | View raw


This is what is interesting: (you can't do what the following does)

---------------------------
#include <Wy.stdio.h>
#include <Wy.unistd.h>
#include <Wy.signal.h>

using namespace Wy;

const char* LogFile="log.tmp";
RegFile logfile(LogFile,O_CREAT|O_TRUNC|O_WRONLY,S_IRUSR|S_IWUSR);

void sig_handler(int sig_num) {
 SignaledContext sigcontext;
 // File I/O (regular,character,socket,fifo,..) are async-signal safe. 
 try {
   String str;

   str << "sig_handler(" << sig_num << ") ";
   logfile << str;
   cout << str;
 }
 catch(const Errno& e) {
   logfile << wrd(e) << ' ';
 };
};

int main(int argc, const char* argv[]) try {
 Errno r;
 ::signal(SIGINT,sig_handler);

  logfile << '1';
   if(argc) {
     logfile << '2';
  }
  logfile << '3';

 for(int i=0; i<3; ++i) {
   ::pause();
 };
 return 0;
}
catch(const Errno& e) {
 cerr << wrd(e) << WY_ENDL;
 return e.c_errno();
}
catch(...) {
 cerr << "main() caught(...)" WY_ENDL;
 throw;
};

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


Thread

Interesting results Bonita Montero <Bonita.Montero@gmail.com> - 2024-11-24 17:29 +0100
  Re: Interesting results Paavo Helde <eesnimi@osa.pri.ee> - 2024-11-25 00:25 +0200
    Re: Interesting results Bonita Montero <Bonita.Montero@gmail.com> - 2024-11-25 06:32 +0100
  Re: Interesting results Michael S <already5chosen@yahoo.com> - 2024-11-25 01:04 +0200
    Re: Interesting results Bonita Montero <Bonita.Montero@gmail.com> - 2024-11-25 06:32 +0100
  Re: Interesting results wij <wyniijj5@gmail.com> - 2024-11-26 03:32 +0800
    Re: Interesting results wij <wyniijj5@gmail.com> - 2024-11-26 03:41 +0800

csiph-web