Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. The Lounge
  3. Grotesque C tricks

Grotesque C tricks

Scheduled Pinned Locked Moved The Lounge
html
12 Posts 11 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Dan Neely

    Write a small C program, which while compiling takes another program from input terminal, and on running gives the result for the second program.[^]

    3x12=36 2x12=24 1x12=12 0x12=18

    H Offline
    H Offline
    HimanshuJoshi
    wrote on last edited by
    #3

    cool :cool:

    1 Reply Last reply
    0
    • D Dan Neely

      Write a small C program, which while compiling takes another program from input terminal, and on running gives the result for the second program.[^]

      3x12=36 2x12=24 1x12=12 0x12=18

      Mike HankeyM Offline
      Mike HankeyM Offline
      Mike Hankey
      wrote on last edited by
      #4

      Pretty slick...never thought of that?

      "Life can only be understood backwards, but it must be lived forward." Kierkegaard, Søren

      1 Reply Last reply
      0
      • D Dan Neely

        Write a small C program, which while compiling takes another program from input terminal, and on running gives the result for the second program.[^]

        3x12=36 2x12=24 1x12=12 0x12=18

        N Offline
        N Offline
        NormDroid
        wrote on last edited by
        #5

        Almost as a bad as a VB user I worked with on an airport project. His concept of multithreading was to how 2 programs running on the same server and commuting data between them via tcp/ip X| Luckily the error was corrected with an immediate rewrite in C++.

        Software Kinetics - The home of good software

        A R B 3 Replies Last reply
        0
        • D Dan Neely

          Write a small C program, which while compiling takes another program from input terminal, and on running gives the result for the second program.[^]

          3x12=36 2x12=24 1x12=12 0x12=18

          _ Offline
          _ Offline
          _stefanu_
          wrote on last edited by
          #6

          You should check out IOCCC.

          D 1 Reply Last reply
          0
          • _ _stefanu_

            You should check out IOCCC.

            D Offline
            D Offline
            Dan Neely
            wrote on last edited by
            #7

            I'm well aware of it, stuff like the pi calculator[^] is awesome. That was simply grotesque.

            3x12=36 2x12=24 1x12=12 0x12=18

            1 Reply Last reply
            0
            • D Dan Neely

              Write a small C program, which while compiling takes another program from input terminal, and on running gives the result for the second program.[^]

              3x12=36 2x12=24 1x12=12 0x12=18

              R Offline
              R Offline
              Rajasekharan Vengalil
              wrote on last edited by
              #8

              Neat. Works with VC++ as well. Like so:

              D:\Code\vc\solos>type reader.c
              #include "CON"

              D:\Code\vc\solos>cl /nologo reader.c
              reader.c
              int printf(); int main(int argc, char *argv[]) { printf("hello, world\n"); return 0; }

              D:\Code\vc\solos>reader.exe
              hello, world

              -- Raj alias "Ranju" alias "gleat" http://blogorama.nerdworks.in[^] --

              1 Reply Last reply
              0
              • N NormDroid

                Almost as a bad as a VB user I worked with on an airport project. His concept of multithreading was to how 2 programs running on the same server and commuting data between them via tcp/ip X| Luckily the error was corrected with an immediate rewrite in C++.

                Software Kinetics - The home of good software

                A Offline
                A Offline
                austin hamman
                wrote on last edited by
                #9

                actually thats a perfectly fine method of concurrency (known actually as multi-programming) his only error was using visual basic. multi-programming is a common mechanism for *nix programs (usually with a client/daemon setup, or a small program that runs and then goes away) though on *nix you wouldnt use sockets you might use pipes but more likely you just do your stuff via stdout/stdin or if you used fork() then ipc is done via shared memory. it usually faster to spawn a process in a *nix environment than, say, a windows environment. also by splitting a program into two you can make development easier, more secure (as you can have one program that needs certain permissions running under those permissions with well defined and tested interfaces)

                1 Reply Last reply
                0
                • N NormDroid

                  Almost as a bad as a VB user I worked with on an airport project. His concept of multithreading was to how 2 programs running on the same server and commuting data between them via tcp/ip X| Luckily the error was corrected with an immediate rewrite in C++.

                  Software Kinetics - The home of good software

                  R Offline
                  R Offline
                  Rick Shaub
                  wrote on last edited by
                  #10

                  Since pre-.NET VB doesn't support multithreading (even using Win32 DLL imports), this is a legitimate method of concurrency.

                  1 Reply Last reply
                  0
                  • D Dan Neely

                    Write a small C program, which while compiling takes another program from input terminal, and on running gives the result for the second program.[^]

                    3x12=36 2x12=24 1x12=12 0x12=18

                    E Offline
                    E Offline
                    englebart
                    wrote on last edited by
                    #11

                    Not legal in C++, but it worked in C.

                    switch (i) {
                    case 0:
                    case 1:
                    f0and1();
                    if (i != 1) {
                    case 2:
                    f0and2(); // but not 1
                    }
                    case 3:
                    f0and1and2and3();
                    }

                    The if statement around the case is the kicker.

                    1 Reply Last reply
                    0
                    • N NormDroid

                      Almost as a bad as a VB user I worked with on an airport project. His concept of multithreading was to how 2 programs running on the same server and commuting data between them via tcp/ip X| Luckily the error was corrected with an immediate rewrite in C++.

                      Software Kinetics - The home of good software

                      B Offline
                      B Offline
                      Ben Breeg
                      wrote on last edited by
                      #12

                      Norm .net wrote:

                      His concept of multithreading was to how 2 programs running on the same server and commuting data between them via tcp/ip

                      This could be done easily on the Commodore Amiga. Instead of using tcp/ip one used Arexx instead; the Amiga interpretation of the Rexx language.

                      I am the Breeg, goo goo g'joob Aici zace un om despre care nu sestie prea mult

                      1 Reply Last reply
                      0
                      Reply
                      • Reply as topic
                      Log in to reply
                      • Oldest to Newest
                      • Newest to Oldest
                      • Most Votes


                      • Login

                      • Don't have an account? Register

                      • Login or register to search.
                      • First post
                        Last post
                      0
                      • Categories
                      • Recent
                      • Tags
                      • Popular
                      • World
                      • Users
                      • Groups