Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-4041-

namespace and #define

Name: Anonymous 2010-09-30 4:03

Hello

I noticed that when I use #define inside a namespace then this #define only
works when prefixed with the namespace name.

Is this behaviour standard or just compiler specific?

I use VC7.

namespace test
{
#define X int
};

Now can be used as:

test::X

--
Elias

Name: Anonymous 2010-09-30 4:10

Faggot nigger.

Name: Anonymous 2010-09-30 4:18

Hello, Elias.

[code] tags.
Indentation.

Name: sage here too 2010-09-30 4:36

0/10. You don't even trying.

Name: Anonymous 2010-09-30 4:55

Pebkac

Name: Anonymous 2010-09-30 5:38

>>1
Macros don't follow C++ scope.

Name: Anonymous 2010-09-30 5:53

#defines are evil.

Name: Anonymous 2010-09-30 9:45

>>4
:(

???????????????? ???????????????? ????????????????, show me what a ???????????????? troll is, in your humble opinion

Name: Anonymous 2010-09-30 10:16

>>3
Please, bolding a name is better effective when implying `You're person, aren't you?' where person is previously known by at least one other /anus/dolyte, and exhibits traits present in the post quoted.

Name: Anonymous 2010-09-30 10:27

>>9
Please, bolding a name is better effective when implying `You'
Stopped parsing right there.

Name: Anonymous 2010-09-30 10:38

>>10
Sorry, I menta s/\'/\\&/

Name: Anonymous 2010-09-30 15:37

>>1
There is no semicolon after a namespace definition.

Name: Anonymous 2010-09-30 16:00

DEFINE MY namespace

Name: Anonymous 2010-09-30 16:35

Haskell is a medium-sized dog

Name: Anonymous 2010-09-30 17:43

>>14
* was

Name: Anonymous 2010-09-30 18:32

>>14
U MENA DAG

Name: Anonymous 2010-09-30 19:13

>>15
:(

Name: Anonymous 2010-10-01 5:29

Macros do replacement without taking account namespace rules etc. So macro should expand test::X to test::int
which is non-sensical. Just using X should have been good.

Name: Anonymous 2010-10-01 9:15

>>18
YHBT.

Name: C STRING PROGRAM 2010-10-01 13:34

K so my programming teacher is new and sucks balls at communicating anything, so I'm having serious issues with this assignment. Can anyone set up at least a pseudocode explanation of how to do this program in C?

Here's the details of what it should do:

You must create two programs that encode and decode plain text files.  The encryption is a simple cipher, replacing each alphanumeric symbol with a shifted value.  Here are two examples:

    Dog3        =>    shifted +1    =>    Eph4
    Cat….0    =>    shifted -1    =>    Bzs….9

Only letter (upper and lower case) and numeric (0 through 9) symbols should be affected.  All other symbols should pass through encryption and decryption unaffected.  The shifting of a symbol should wrap-around its set.  For example, the symbol “a” shifted -1 should become “z”.  The symbol “9” shifted +1 should become “0”.  The symbol “Z” shifted +2 should become “B”.  This is also demonstrated in the examples above.

The first program should encode text.  It should prompt for one word (string) at a time, encode it, and print out the encoded version.  This should continue until the single symbol “.” is given as input, which should terminate the program.  The first program must accept a single command line argument defining the shift delta.  The value of delta must be an integer between -9 and +9, inclusive.

The second program should decode encrypted text.  It should be unaware of the value of delta used to encode the text.  Instead, it must figure out the value of delta by trying to decrypt using all possible values for delta and examining the resulting text.  To examine the result, the program must use the dictionary stored in the linux.words file.  It should compare every potential decrypted word with the dictionary, looking for a match.  Whichever value for delta produces the most matches with words in the dictionary should be assumed to be the correct value for delta.  The program should print out the decrypted text using that value of delta (and it should not print out anything else).

Assume that the message being encrypted or decrypted consists of less than 100 words, and that no word is longer than 30 characters.

WAT DO?!?!?!?

Name: Anonymous 2010-10-01 13:36

noko

Name: Anonymous 2010-10-01 13:36

Do your own homework.

Name: Anonymous 2010-10-01 13:41

>>20
Fuck Caesar and his ciphers but thanks for not raising another abortion of a thread.

Name: Anonymous 2010-10-01 14:02

>>20
Try looking at your textbook some time.

Name: Anonymous 2010-10-01 14:17

>>24
Try looking at your anus some time

Name: Anonymous 2010-10-01 15:24

>>20
First implement a function char *str_shift(const char *s, int how_much); and make sure it really works. Then, write a function int match_score(char *c); that takes every word in /usr/share/dict/words, ignoring 1-letter words, and tries to match it against the string, adding the length of the word to the score every time the word is matched. The rest should be fairly trivial.

Name: Anonymous 2010-10-01 15:34

>>25 +1 Insightful

Name: Anonymous 2010-10-01 18:39

>>26
What if he's not using LINUX

Name: Anonymous 2010-10-01 18:50

>>28
should be fine for most modern unicies, he may have to adjust his paths to suit
see also: fairly trivial

Name: Anonymous 2010-10-01 21:06

>>1
No compiler should accept this, and I'm not familiar
with any such extension in VC7 or elsewhere.
Could you post the exact code that lead you to your conclusion?

Name: Anonymous 2010-10-01 21:59

>All other symbols should pass through encryption and decryption unaffected.

Oh man. As if Caesar was not week enough.

Name: Anonymous 2010-10-02 0:57

Oh man. As if Caesar was not week enough.
Oh man. As if your grammar was not weak enough.

Name: Anonymous 2010-10-02 1:35

>>29
I meant what if he's using windows

Name: Anonymous 2010-10-02 3:35

>>33

Listen here, Susana. Don't you waste /anus/'s time with trifling matters. There are at least two trivial solutions to that problem.

Name: Anonymous 2010-10-02 8:55

>>32
Oh man. As if your grammers weren't weak enough.

Name: Anonymous 2010-10-02 11:48

>>35
wat

Name: Anonymous 2010-10-02 11:54

Why doesn't the C proprecessor have loops and other features that your typical macro assembler would have?

Name: Anonymous 2010-10-02 12:53

>>37
Because you touch /proc/self at night.

Name: Anonymous 2010-11-25 7:09

Name: Anonymous 2010-11-29 5:06

test

Name: Anonymous 2011-03-01 20:21

>>40
Stop testing. You think we won't notice you even though this is not on the front page?

Name: Anonymous 2011-03-01 20:28

True story.

A female coworker of mine (inb4 no women in CS) wrote the following:

#define temp_too_high
if ( temp > 100 )
{
    #define temp_too_high true
}
else
{
    #define temp_too_high false
}

// ...

if ( temp_too_high )
{
    // safety mechanism for high temperature
}

Name: Anonymous 2011-03-01 20:30

>>44
implying that's ``computer science''

Name: Anonymous 2011-03-01 20:43

>>45
Go away, ``noko''.

Name: Anonymous 2011-03-01 20:51

>>46

u mad?

Name: Anonymous 2011-03-01 22:17

>>46
Fuck off, ``faggot''.

Name: Anonymous 2011-03-01 22:48

>>20
>>20
I'll help you when my C compiler is downloaded and installed.

Name: Anonymous 2011-03-01 23:00

>>20
Didn't notice that was 2010, you must be dead now.

Name: Anonymous 2011-03-01 23:24

Use a real language where macros, are actuallu macros.

Name: Anonymous 2011-03-02 2:41

>>1
S͔̥̠͉̲̺̖̖͢͜ͅe҉̸͍͙̤͎͖͎̼̟̗̯̩̫̣̩̘̭̙͙̭g͏̴̷̛̭̞̩̖̫͉̮̬̤͔ͅḿ̶̡̻͈̫͎̻̜̭̠͈̤͠ͅe̶̸̸͍͕̙͕̜̝͉͖͎̮̹̫̩͚͇̪̱͞n͘҉̢͎̬̥̫̲̮̗͙̮̥͎̣͚͈̞t̴̶̢̩̼͇̖͍͎̞͚̮͙̖̗̤̯̣̣̰̰̀́a̴̩̮̱͉̤̝̼͈͚̜̬̥̫̩̻̬͟ͅt̨̜͈̯̝̱͕͕͓͍̠̱̼̣͎̘̺̭͞i̸̧̢̯̜̯̝͙͕͕̬̹̥̻͔̗͢͠o̢̱̝̪͕͜͡n̵͓̞̠̮̰̳̩͕͘͟͢ ̛̞̰̬͓̥̥́͢ͅF҉̶̸̡̜̳̣͍͓͈̖̱͖̗̕à̢͈̲͙̙̳̱̹ù̡̫͓̺͓̕ĺ̨̯̮̭̖̹̠̱̠̭̬̺̳͍̼̬̺̤̲̯͟͞͡t̢̙̗͈̝̼̠͓̺͖̦͎͚̟̳̹̥̬́̕͡

Don't change these.
Name: Email:
Entire Thread Thread List