How about adding NEW Special Tokens?? For ease and Security

KennyTM~ kennytm at gmail.com
Wed May 25 07:46:16 PDT 2011


On May 25, 11 22:23, Matthew Ong wrote:
> On 5/25/2011 9:45 PM, Daniel Gibson wrote:
>
>
>  >.stringof[7 .. $]
> Belonging to which object or variable?

Belongs to the module. '.xxx' is D's syntax for access a global object 
(derived from C++'s '::xxx' syntax). Please read through the whole D 
specification.

(Frankly speaking this is a DMD-specific hack as the spec has never 
required that the .stringof of a module must return "module foo.bar.baz".)

>
> 4) __BLOCKNAME__ // perhaps another name, but prints
>  >> class/struct/interface/template... name. If is global, print global.
> How about this one? The class which the fuction belows
>
> http://www.digitalmars.com/d/archives/digitalmars/D/FUNCTION_implemented_with_mixins_and_mangles_92055.html
>
>
>
> ---------------------------------------------------------------------------
>
>> Use those functions (getuid(), getpid(), etc.) if you need those values.
>>> Why make them look like compile-time special tokens?
>>>
> It would be even more cool if there is some immutable >RUNTIME< special
> tokens:

It is easy to tell if a runtime function returns "immutable" value: a 
pure function that takes no arguments.

     pure int f();
   //^^^^

>
> Defining them as variable makes the code independent from
> OS(win32/lin/OSX) API.
>
> 1) __LOGIN__ // Current user login id, eg: johnchia
> 2) __UID__ // User login number, eg: 0, 304,1234,...
> 3) __PID__ // Current program process id
> 4) __PPID__ // Parent process id
> 5) __STIME__ // Start time, date time,2011-02-23 14:45, to see if there
> is a long over due program.
> 6) __CMDLINE__ // prints full path name C:\Program
> Files\Notepad++\notepad.exe
> 7) __TOTMEM__ // Total amount of memory being used. Read Only, but dynamic.
> 8) __MAXMEM__ //
>
> These runtime tokens will be very useful for developer to do secure
> coding to check for some runtime Access Control Information or
> preventing denial of service and maybe anti buffer over flowing attacks.
> Perhaps the runtime special information are already available. If not,
> that might be in the future version.

I don't see how these 8 information _prevent_ DoS attack.  And D already 
has anti-buffer-overflow protection: range checking (in SafeD, at least).

>
> Thanks very much for the URL.
>



More information about the Digitalmars-d mailing list